search
HomeBackend DevelopmentPHP TutorialWhy do only 4 options appear after switching in this frame?

Why do only 4 options appear after switching in this frame?

If you want it to display 8 contents, that is, two lines, change

in appsindexcontrollersindex.php
<code>    $recentItems = $itemsClass->getAll(0, 4 " `status` = 'active' ", '`datetime` DESC');</code>

was modified to

<code>    $recentItems = $itemsClass->getAll(0, 8, " `status` = 'active' ", '`datetime` DESC');</code>

The refresh does show 8 contents, and they are two lines,
But when you click any button above, it becomes 4 again

The page html is as follows

<code><section class="clearfix" id="recent-files-wrapper">
            <div class="container p-t-md m-t-lg m-b-lg m-xs-t-none m-xs-b-none" id="recent-files">
              <div class="m-b-md m-xs-b h3">
                <span class="font-thin h3-xs text-black">最新上传的作品</span>
              </div>
              {if $recentItems}
              <div class="row m-b-lg m-xs-b">
                <div class="col-sm-11 ajaxa">
                  
                  <span>
                  <a cate-id="all" href="/%7B%24languageURL%7Dcategories/all/" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs active">全部</a>
                  </span>
                  {if $mainCategories}
                  {foreach from=$mainCategories item=c}

                  <span>
                  <a cate-id="3" href="/%7B%24languageURL%7Dcategories/3" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">婚礼相册</a>
                  </span>
                  <span>
                  <a cate-id="23" href="/%7B%24languageURL%7Dcategories/23" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">清新简约</a>
                  </span>
                  <span>
                  <a cate-id="8" href="/%7B%24languageURL%7Dcategories/8" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">企业宣传</a>
                  </span>
                  <span>
                  <a cate-id="2" href="/%7B%24languageURL%7Dcategories/2" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">生日祝寿</a>
                  </span>
                  <span>
                  <a cate-id="4" href="/%7B%24languageURL%7Dcategories/4" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">毕业纪念</a>
                  </span>
                  <span>
                  <a cate-id="11" href="/%7B%24languageURL%7Dcategories/11" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">片头LOGO</a>
                  </span>
                  <span>
                  <a cate-id="5" href="/%7B%24languageURL%7Dcategories/5" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">儿童卡通</a>
                  </span>
                  <span>
                  <a cate-id="13" href="/%7B%24languageURL%7Dcategories/13" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">唯美浪漫</a>
                  </span>
                  <span>
                  <a cate-id="9" href="/%7B%24languageURL%7Dcategories/9" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">写真MV</a>
                  </span>
                  <span>
                  <a cate-id="12" href="/%7B%24languageURL%7Dcategories/12" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">年会颁奖</a>
                  </span>
                  <span>
                  <a cate-id="24" href="/%7B%24languageURL%7Dcategories/24" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">震撼大气</a>
                  </span>
                  <span>
                  <a cate-id="6" href="/%7B%24languageURL%7Dcategories/6" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">节日庆典</a>
                  </span>
                  <span>
                  <a cate-id="10" href="/%7B%24languageURL%7Dcategories/10" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">动感时尚</a>
                  </span>
                  <span>
                  <a cate-id="22" href="/%7B%24languageURL%7Dcategories/22" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">白事葬礼</a>
                  </span>
                  <span>
                  <a cate-id="14" href="/%7B%24languageURL%7Dcategories/14" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">微信小视频</a>
                  </span>
                  <span>
                  <a cate-id="15" href="/%7B%24languageURL%7Dcategories/15" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">水墨中国风</a>
                  </span>
                  <span>
                  <a cate-id="25" href="/%7B%24languageURL%7Dcategories/25" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">字幕条</a>

                  </span>
                  
                  {/foreach}
                  {/if}
                </div>
                <div class="col-sm-1 text-right text-left-xs visible-lg">
                  <a href="/%7B%24languageURL%7Dcategories/all/" target="_blank" class="btn btn-ghost-success btn-rounded">
                    更多
                  </a>
                </div>
              </div>
              <div class="row" id="cateitemslist">
                {foreach from=$recentItems item=i}
                <div class="col-xs-6 col-sm-6 col-md-3 ">
                  <section class="panel mb-col no-radius no-shadow">
                    <div class="panel-body no-padder">
                      <div class="img-container fx-img-zoom-in fx-opt-zoom-in">
                        <img class="img-responsive lazy" src="/static/imghwm/default1.png" data-src="{$data_server}uploads/items/{$i.id}/{$i.thumbnail}" alt="Why do only 4 options appear after switching in this frame?"   style="max-width:90%">
                        <div class="img-options">
                          <div class="img-options-content">
                            <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="btn btn-success btn-lg m-r-md hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="查看演示">
                              <i class="i i-layer2"></i>
                            </a>
                            <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="btn btn-danger btn-lg" data-toggle="tooltip" data-placement="bottom" data-original-title="了解详情">
                              <i class="i i-eye"></i>
                            </a>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="panel-footer pos-rlt bg-white-only panel-shadow no-radius">
                      <div class="ss-underline">
                        <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank">
                          {foreach from=$i.categories item=e}
                          {foreach from=$e item=c name=foo}
                          {if $smarty.foreach.foo.last}{$categories[$c].name}{/if}
                          {/foreach}
                          {/foreach}
                        </a>
                      </div>
                      <div class="clearfix">
                        <div class="datetime m-r-sm pull-left hidden-xs">
                          <span class="date">{$i.price}</span>
                          <span class="month">¥</span>
                        </div>
                        <h4 id="a-href-B-languageURL-Ditems-B-i-id-D-target-blank-class-height-h-Why-do-only-options-appear-after-switching-in-this-frame-a"><a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="height-h4">Why do only 4 options appear after switching in this frame?</a></h4>
                      </div>
                      <a href="/%7B%24languageURL%7Duser/%7B%24users%5B%24i.user_id%5D.username%7D" target="_blank" class="panel-thumb hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="{$users[$i.user_id].nickname}">
                        {if $users[$i.user_id].avatar != ''}
                        <img class="img-circle lazy" src="/static/imghwm/default1.png" data-src="{$data_server}uploads/users/{$i.user_id}/A_{$users[$i.user_id].avatar}" alt="{$users[$i.user_id].nickname}">
                        {else}
                        <img class="img-circle lazy" src="/static/imghwm/default1.png" data-src="{$data_server}home/default/img/default-user.jpg" alt="{$users[$i.user_id].nickname}">
                        {/if}
                      </a>

                    </div>
                  </section>
                </div>
                {/foreach}
              </div>

              <div id="itemloading"><img src="/static/imghwm/default1.png" data-src="{$template_data}img/loading3.gif" class="lazy" alt="加载中"></div>
            </div>
            {literal}
            <script type="text/javascript">
              seajs.use(["jq", "pageui"], function($, ui){
                ui.itemlistAjax($("#recent-files .catelinks"), $("#cateitemslist"), $("#itemloading"));
              });
            </script>
            {/literal}
          </section>
          {/if}</code>

appsindexcontrollersindex.php code is as follows:

<code><?php // +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);


    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
            
    $users = $usersClass->getAll(0, 0, $itemsClass->usersWhere);
    abr('users', $users);


#推荐作品
    $weeklyItems = $itemsClass->getAll(0, 4, " `status` = 'active' AND `weekly_to` >= '".date('Y-m-d')."' ", "`datetime` DESC");
    abr('weeklyItems', $weeklyItems);
    
    if($itemsClass->foundRows > 10) {
        abr('haveWeekly', 'yes');
    }

#加载分类
        require_once ROOT_PATH.'/apps/categories/models/categories.class.php';
        $categoriesClass = new categories();
    
        $categories = $categoriesClass->getAll();
        abr('categories', $categories);     
    
#近期作品
    $recentItems = $itemsClass->getAll(0, 8, " `status` = 'active' ", '`datetime` DESC');
    kshuffle($recentItems);
    abr('recentItems', $recentItems);
    
    //免费作品
    $freeItem = $itemsClass->getAll(0, 4, " `status` = 'active' AND `free_file` = 'true' ", '`datetime` DESC');

    abr('freeItem', $freeItem);
    
#推荐作者
    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
    //获取用户信息及粉丝
    $featuredAuthor = $usersClass->getAll(0, 0, " `status` = 'activate' AND `featured_author` = 'true' ", 'RAND()');
    // if(is_array($featuredAuthor)) {
    //     //作者的一些作品
    //     $featuredItems = array();
    //      foreach($featuredAuthor as $itear){
    //         $featuredItems[$itear['user_id']] = $itemsClass->getAll(0, 2, " `status` = 'active' AND `user_id` = '".intval($itear['user_id'])."' ");
    //     }
    //     abr('featuredItems', $featuredItems);
        
    //     abr('featuredAuthorInfo', langMessageReplace($langArray['featured_author_info'], array(
    //                                                             'USERNAME' => $featuredAuthor['username'],
    //                                                             'MONTH' => $langArray['monthArr'][date('n', strtotime($featuredAuthor['register_datetime']))],
    //                                                             'YEAR' => date('Y', strtotime($featuredAuthor['register_datetime'])),
    //                                                             'ITEMS' => $featuredAuthor['items'],
    //                                                             'SALES' => $featuredAuthor['sales']
    //                                                         )));
    // }
    abr('featuredAuthor', $featuredAuthor);


#推荐作者
    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
    $newAuthor = $usersClass->getAll(0, 8, " `status` = 'activate' ", 'RAND()');
    abr('newAuthor', $newAuthor);

#用户关注的作者的最新作品
    if(check_login_bool()) {
        $following = $usersClass->getFollowersID($_SESSION['user']['user_id']);
        if(is_array($following)) {
            $whereQuery = '';
            foreach($following as $f) {
                if($whereQuery != '') {
                    $whereQuery .= ' OR ';
                }
                $whereQuery .= " `user_id` = '".intval($f['follow_id'])."' ";
            }
            
            $followingItems = $itemsClass->getAll(0, 0, " `status` = 'active' AND ($whereQuery) ", "`datetime` DESC");
            abr('followingItems', $followingItems);
            
            abr('followingItemsCount', $itemsClass->foundRows);
            abr('emptyThumb', (10-$itemsClass->foundRows));
        }
    }
#王牌作者
    

        $topAuthors = $usersClass->getAll(0, 9, " `status` = 'activate' and `sales` > 0 ", "`sales` DESC");
        abr('topAuthors', $topAuthors);
        
        abr('topAuthorsCount', $usersClass->foundRows);
        abr('emptyThumb', (9-$usersClass->foundRows));
        
    

#随机分类
    $randCategories = array_rand($mainCategories, 5);
    abr('randCategories', $randCategories);    
    
#最低价格
    $lowPrice = $itemsClass->getAll(0, 1, " `status` = 'active' ", "`price` ASC");
    if(is_array($lowPrice)) {
        $lowPrice = array_shift($lowPrice);
        $lowPrice = $lowPrice['price'];
    }
    abr('lowPrice', $lowPrice);
    
#快讯
    
    require_once ROOT_PATH.'/apps/qnews/models/qnews.class.php';
    $qnews = new qnews();
    $data = array();
    foreach($qnews->getAll(0, 1, "`visible` = 'true'") AS $key => $value) {
        if($value['photo']) {
            $data[$key] = $value;
            $data[$key]['thumb'] = 'static/uploads/qnews/260x140/' . $value['photo'];
        }
    }
    
    abr('qnews_data', $data);
    
#面包屑
    abr('breadcrumb', '<a href="/'.%24languageURL.'" title="">'.$langArray['home'].'</a>');


//读取所有tags   require_once ROOT_PATH. "/apps/tags/models/tags.class.php";//引入tag的数据库模型类
//读取所有tags           $tags = new tags();
//读取所有tags           $getTags = $tags->getAll();//获取数据模型,结果为一个数组
//读取所有tags           abr('tags_new',$getTags);//在smarty模板中加入变量‘tags_new’
//读取所有tags {foreach from=$tags_new item=t}
//读取所有tags {$t.name}
//读取所有tags {/foreach}
    
//开始。。
//获取所有一级分类
    require_once ROOT_PATH . "/apps/categories/models/categories.class.php";
    $categoriesClass = new categories();
    $allCategories_0 = $categoriesClass->getAll(0, 0, " `visible` = 'true' AND `sub_of`=0 ");
    $data = array();
    foreach ($allCategories_0 as $categories_data) {
        //获取当前分类子分类
        $categories_son = $categoriesClass->getAll(0, 0, " `visible` = 'true' AND `sub_of`= ".intval($categories_data['id'])." ");
        //获取一级分类下得所有作品
        $whereQuery = " AND `id` IN (SELECT `item_id` FROM `items_to_category` WHERE `categories` LIKE '%,".intval($categories_data['id']).",%') ";
        $items = $itemsClass->getAll(0, 0, " `status` = 'active' ".$whereQuery);
        $data[$categories_data['id']][] = array(
            'categories' => $categories_data,
            'categories_son' => $categories_son,
            'items' => $items
        );
    }
    abr('data',$data);
    
?></code>

Website address

Reply content:

Why do only 4 options appear after switching in this frame?

If you want it to display 8 contents, that is, two lines, change

in appsindexcontrollersindex.php
<code>    $recentItems = $itemsClass->getAll(0, 4 " `status` = 'active' ", '`datetime` DESC');</code>

was modified to

<code>    $recentItems = $itemsClass->getAll(0, 8, " `status` = 'active' ", '`datetime` DESC');</code>

The refresh does show 8 contents, and they are two lines,
But when you click any button above, it becomes 4 again

The page html is as follows

<code><section class="clearfix" id="recent-files-wrapper">
            <div class="container p-t-md m-t-lg m-b-lg m-xs-t-none m-xs-b-none" id="recent-files">
              <div class="m-b-md m-xs-b h3">
                <span class="font-thin h3-xs text-black">最新上传的作品</span>
              </div>
              {if $recentItems}
              <div class="row m-b-lg m-xs-b">
                <div class="col-sm-11 ajaxa">
                  
                  <span>
                  <a cate-id="all" href="/%7B%24languageURL%7Dcategories/all/" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs active">全部</a>
                  </span>
                  {if $mainCategories}
                  {foreach from=$mainCategories item=c}

                  <span>
                  <a cate-id="3" href="/%7B%24languageURL%7Dcategories/3" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">婚礼相册</a>
                  </span>
                  <span>
                  <a cate-id="23" href="/%7B%24languageURL%7Dcategories/23" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">清新简约</a>
                  </span>
                  <span>
                  <a cate-id="8" href="/%7B%24languageURL%7Dcategories/8" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">企业宣传</a>
                  </span>
                  <span>
                  <a cate-id="2" href="/%7B%24languageURL%7Dcategories/2" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">生日祝寿</a>
                  </span>
                  <span>
                  <a cate-id="4" href="/%7B%24languageURL%7Dcategories/4" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">毕业纪念</a>
                  </span>
                  <span>
                  <a cate-id="11" href="/%7B%24languageURL%7Dcategories/11" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">片头LOGO</a>
                  </span>
                  <span>
                  <a cate-id="5" href="/%7B%24languageURL%7Dcategories/5" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">儿童卡通</a>
                  </span>
                  <span>
                  <a cate-id="13" href="/%7B%24languageURL%7Dcategories/13" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">唯美浪漫</a>
                  </span>
                  <span>
                  <a cate-id="9" href="/%7B%24languageURL%7Dcategories/9" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">写真MV</a>
                  </span>
                  <span>
                  <a cate-id="12" href="/%7B%24languageURL%7Dcategories/12" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">年会颁奖</a>
                  </span>
                  <span>
                  <a cate-id="24" href="/%7B%24languageURL%7Dcategories/24" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">震撼大气</a>
                  </span>
                  <span>
                  <a cate-id="6" href="/%7B%24languageURL%7Dcategories/6" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">节日庆典</a>
                  </span>
                  <span>
                  <a cate-id="10" href="/%7B%24languageURL%7Dcategories/10" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">动感时尚</a>
                  </span>
                  <span>
                  <a cate-id="22" href="/%7B%24languageURL%7Dcategories/22" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">白事葬礼</a>
                  </span>
                  <span>
                  <a cate-id="14" href="/%7B%24languageURL%7Dcategories/14" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">微信小视频</a>
                  </span>
                  <span>
                  <a cate-id="15" href="/%7B%24languageURL%7Dcategories/15" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">水墨中国风</a>
                  </span>
                  <span>
                  <a cate-id="25" href="/%7B%24languageURL%7Dcategories/25" target="_blank" class="catelinks btn btn-ghost-success btn-rounded btn-xs-xs m-b-xs m-l-sm m-xs-l-xs">字幕条</a>

                  </span>
                  
                  {/foreach}
                  {/if}
                </div>
                <div class="col-sm-1 text-right text-left-xs visible-lg">
                  <a href="/%7B%24languageURL%7Dcategories/all/" target="_blank" class="btn btn-ghost-success btn-rounded">
                    更多
                  </a>
                </div>
              </div>
              <div class="row" id="cateitemslist">
                {foreach from=$recentItems item=i}
                <div class="col-xs-6 col-sm-6 col-md-3 ">
                  <section class="panel mb-col no-radius no-shadow">
                    <div class="panel-body no-padder">
                      <div class="img-container fx-img-zoom-in fx-opt-zoom-in">
                        <img class="img-responsive lazy" src="/static/imghwm/default1.png" data-src="{$data_server}uploads/items/{$i.id}/{$i.thumbnail}" alt="Why do only 4 options appear after switching in this frame?"   style="max-width:90%">
                        <div class="img-options">
                          <div class="img-options-content">
                            <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="btn btn-success btn-lg m-r-md hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="查看演示">
                              <i class="i i-layer2"></i>
                            </a>
                            <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="btn btn-danger btn-lg" data-toggle="tooltip" data-placement="bottom" data-original-title="了解详情">
                              <i class="i i-eye"></i>
                            </a>
                          </div>
                        </div>
                      </div>
                    </div>
                    <div class="panel-footer pos-rlt bg-white-only panel-shadow no-radius">
                      <div class="ss-underline">
                        <a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank">
                          {foreach from=$i.categories item=e}
                          {foreach from=$e item=c name=foo}
                          {if $smarty.foreach.foo.last}{$categories[$c].name}{/if}
                          {/foreach}
                          {/foreach}
                        </a>
                      </div>
                      <div class="clearfix">
                        <div class="datetime m-r-sm pull-left hidden-xs">
                          <span class="date">{$i.price}</span>
                          <span class="month">¥</span>
                        </div>
                        <h4 id="a-href-B-languageURL-Ditems-B-i-id-D-target-blank-class-height-h-Why-do-only-options-appear-after-switching-in-this-frame-a"><a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="height-h4">Why do only 4 options appear after switching in this frame?</a></h4>
                      </div>
                      <a href="/%7B%24languageURL%7Duser/%7B%24users%5B%24i.user_id%5D.username%7D" target="_blank" class="panel-thumb hidden-xs" data-toggle="tooltip" data-placement="bottom" data-original-title="{$users[$i.user_id].nickname}">
                        {if $users[$i.user_id].avatar != ''}
                        <img class="img-circle lazy" src="/static/imghwm/default1.png" data-src="{$data_server}uploads/users/{$i.user_id}/A_{$users[$i.user_id].avatar}" alt="{$users[$i.user_id].nickname}">
                        {else}
                        <img class="img-circle lazy" src="/static/imghwm/default1.png" data-src="{$data_server}home/default/img/default-user.jpg" alt="{$users[$i.user_id].nickname}">
                        {/if}
                      </a>

                    </div>
                  </section>
                </div>
                {/foreach}
              </div>

              <div id="itemloading"><img src="/static/imghwm/default1.png" data-src="{$template_data}img/loading3.gif" class="lazy" alt="加载中"></div>
            </div>
            {literal}
            <script type="text/javascript">
              seajs.use(["jq", "pageui"], function($, ui){
                ui.itemlistAjax($("#recent-files .catelinks"), $("#cateitemslist"), $("#itemloading"));
              });
            </script>
            {/literal}
          </section>
          {/if}</code>

appsindexcontrollersindex.php code is as follows:

<code><?php // +----------------------------------------------------------------------
// | Demila [ Beautiful Digital Content Trading System ]
// +----------------------------------------------------------------------
// | Copyright (c) 2015 http://demila.org All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Email author@demila.org
// +----------------------------------------------------------------------
_setView(__FILE__);


    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
            
    $users = $usersClass->getAll(0, 0, $itemsClass->usersWhere);
    abr('users', $users);


#推荐作品
    $weeklyItems = $itemsClass->getAll(0, 4, " `status` = 'active' AND `weekly_to` >= '".date('Y-m-d')."' ", "`datetime` DESC");
    abr('weeklyItems', $weeklyItems);
    
    if($itemsClass->foundRows > 10) {
        abr('haveWeekly', 'yes');
    }

#加载分类
        require_once ROOT_PATH.'/apps/categories/models/categories.class.php';
        $categoriesClass = new categories();
    
        $categories = $categoriesClass->getAll();
        abr('categories', $categories);     
    
#近期作品
    $recentItems = $itemsClass->getAll(0, 8, " `status` = 'active' ", '`datetime` DESC');
    kshuffle($recentItems);
    abr('recentItems', $recentItems);
    
    //免费作品
    $freeItem = $itemsClass->getAll(0, 4, " `status` = 'active' AND `free_file` = 'true' ", '`datetime` DESC');

    abr('freeItem', $freeItem);
    
#推荐作者
    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
    //获取用户信息及粉丝
    $featuredAuthor = $usersClass->getAll(0, 0, " `status` = 'activate' AND `featured_author` = 'true' ", 'RAND()');
    // if(is_array($featuredAuthor)) {
    //     //作者的一些作品
    //     $featuredItems = array();
    //      foreach($featuredAuthor as $itear){
    //         $featuredItems[$itear['user_id']] = $itemsClass->getAll(0, 2, " `status` = 'active' AND `user_id` = '".intval($itear['user_id'])."' ");
    //     }
    //     abr('featuredItems', $featuredItems);
        
    //     abr('featuredAuthorInfo', langMessageReplace($langArray['featured_author_info'], array(
    //                                                             'USERNAME' => $featuredAuthor['username'],
    //                                                             'MONTH' => $langArray['monthArr'][date('n', strtotime($featuredAuthor['register_datetime']))],
    //                                                             'YEAR' => date('Y', strtotime($featuredAuthor['register_datetime'])),
    //                                                             'ITEMS' => $featuredAuthor['items'],
    //                                                             'SALES' => $featuredAuthor['sales']
    //                                                         )));
    // }
    abr('featuredAuthor', $featuredAuthor);


#推荐作者
    require_once ROOT_PATH.'/apps/users/models/users.class.php';
    $usersClass = new users();
    $newAuthor = $usersClass->getAll(0, 8, " `status` = 'activate' ", 'RAND()');
    abr('newAuthor', $newAuthor);

#用户关注的作者的最新作品
    if(check_login_bool()) {
        $following = $usersClass->getFollowersID($_SESSION['user']['user_id']);
        if(is_array($following)) {
            $whereQuery = '';
            foreach($following as $f) {
                if($whereQuery != '') {
                    $whereQuery .= ' OR ';
                }
                $whereQuery .= " `user_id` = '".intval($f['follow_id'])."' ";
            }
            
            $followingItems = $itemsClass->getAll(0, 0, " `status` = 'active' AND ($whereQuery) ", "`datetime` DESC");
            abr('followingItems', $followingItems);
            
            abr('followingItemsCount', $itemsClass->foundRows);
            abr('emptyThumb', (10-$itemsClass->foundRows));
        }
    }
#王牌作者
    

        $topAuthors = $usersClass->getAll(0, 9, " `status` = 'activate' and `sales` > 0 ", "`sales` DESC");
        abr('topAuthors', $topAuthors);
        
        abr('topAuthorsCount', $usersClass->foundRows);
        abr('emptyThumb', (9-$usersClass->foundRows));
        
    

#随机分类
    $randCategories = array_rand($mainCategories, 5);
    abr('randCategories', $randCategories);    
    
#最低价格
    $lowPrice = $itemsClass->getAll(0, 1, " `status` = 'active' ", "`price` ASC");
    if(is_array($lowPrice)) {
        $lowPrice = array_shift($lowPrice);
        $lowPrice = $lowPrice['price'];
    }
    abr('lowPrice', $lowPrice);
    
#快讯
    
    require_once ROOT_PATH.'/apps/qnews/models/qnews.class.php';
    $qnews = new qnews();
    $data = array();
    foreach($qnews->getAll(0, 1, "`visible` = 'true'") AS $key => $value) {
        if($value['photo']) {
            $data[$key] = $value;
            $data[$key]['thumb'] = 'static/uploads/qnews/260x140/' . $value['photo'];
        }
    }
    
    abr('qnews_data', $data);
    
#面包屑
    abr('breadcrumb', '<a href="/'.%24languageURL.'" title="">'.$langArray['home'].'</a>');


//读取所有tags   require_once ROOT_PATH. "/apps/tags/models/tags.class.php";//引入tag的数据库模型类
//读取所有tags           $tags = new tags();
//读取所有tags           $getTags = $tags->getAll();//获取数据模型,结果为一个数组
//读取所有tags           abr('tags_new',$getTags);//在smarty模板中加入变量‘tags_new’
//读取所有tags {foreach from=$tags_new item=t}
//读取所有tags {$t.name}
//读取所有tags {/foreach}
    
//开始。。
//获取所有一级分类
    require_once ROOT_PATH . "/apps/categories/models/categories.class.php";
    $categoriesClass = new categories();
    $allCategories_0 = $categoriesClass->getAll(0, 0, " `visible` = 'true' AND `sub_of`=0 ");
    $data = array();
    foreach ($allCategories_0 as $categories_data) {
        //获取当前分类子分类
        $categories_son = $categoriesClass->getAll(0, 0, " `visible` = 'true' AND `sub_of`= ".intval($categories_data['id'])." ");
        //获取一级分类下得所有作品
        $whereQuery = " AND `id` IN (SELECT `item_id` FROM `items_to_category` WHERE `categories` LIKE '%,".intval($categories_data['id']).",%') ";
        $items = $itemsClass->getAll(0, 0, " `status` = 'active' ".$whereQuery);
        $data[$categories_data['id']][] = array(
            'categories' => $categories_data,
            'categories_son' => $categories_son,
            'items' => $items
        );
    }
    abr('data',$data);
    
?></code>

Website address

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

php怎么实现几秒后执行一个函数php怎么实现几秒后执行一个函数Apr 24, 2022 pm 01:12 PM

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php怎么除以100保留两位小数php怎么除以100保留两位小数Apr 22, 2022 pm 06:23 PM

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

php字符串有没有下标php字符串有没有下标Apr 24, 2022 am 11:49 AM

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

php怎么根据年月日判断是一年的第几天php怎么根据年月日判断是一年的第几天Apr 22, 2022 pm 05:02 PM

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php怎么读取字符串后几个字符php怎么读取字符串后几个字符Apr 22, 2022 pm 08:31 PM

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

php怎么替换nbsp空格符php怎么替换nbsp空格符Apr 24, 2022 pm 02:55 PM

方法:1、用“str_replace("&nbsp;","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\&nbsp\;||\xc2\xa0)/","其他字符",$str)”语句。

php怎么判断有没有小数点php怎么判断有没有小数点Apr 20, 2022 pm 08:12 PM

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft