Rumah  >  Artikel  >  pembangunan bahagian belakang  >  为什么这个框架里面的选项切换后只显示4个

为什么这个框架里面的选项切换后只显示4个

WBOY
WBOYasal
2016-09-12 17:44:471156semak imbas

为什么这个框架里面的选项切换后只显示4个

想让它显示8个内容,也就是两行,更改appsindexcontrollersindex.php里的

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

修改为

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

刷新确实显示8个内容,并且是两行,
但是点击上面的任意按钮,又变成4个了

页面html如下

<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" src="%7B%24data_server%7Duploads/items/%7B%24i.id%7D/%7B%24i.thumbnail%7D" alt="{$i.name|escape}"   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 class="m-t-none m-b-none-xs"><a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="height-h4">{$i.name|escape}</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 alt="{$users[$i.user_id].nickname}" class="img-circle" src="%7B%24data_server%7Duploads/users/%7B%24i.user_id%7D/A_%7B%24users%5B%24i.user_id%5D.avatar%7D">
                        {else}
                        <img alt="{$users[$i.user_id].nickname}" class="img-circle" src="%7B%24data_server%7Dhome/default/img/default-user.jpg">
                        {/if}
                      </a>

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

              <div id="itemloading"><img alt="加载中" src="%7B%24template_data%7Dimg/loading3.gif"></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><?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>

网站地址

回复内容:

为什么这个框架里面的选项切换后只显示4个

想让它显示8个内容,也就是两行,更改appsindexcontrollersindex.php里的

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

修改为

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

刷新确实显示8个内容,并且是两行,
但是点击上面的任意按钮,又变成4个了

页面html如下

<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" src="%7B%24data_server%7Duploads/items/%7B%24i.id%7D/%7B%24i.thumbnail%7D" alt="{$i.name|escape}"   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 class="m-t-none m-b-none-xs"><a href="/%7B%24languageURL%7Ditems/%7B%24i.id%7D" target="_blank" class="height-h4">{$i.name|escape}</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 alt="{$users[$i.user_id].nickname}" class="img-circle" src="%7B%24data_server%7Duploads/users/%7B%24i.user_id%7D/A_%7B%24users%5B%24i.user_id%5D.avatar%7D">
                        {else}
                        <img alt="{$users[$i.user_id].nickname}" class="img-circle" src="%7B%24data_server%7Dhome/default/img/default-user.jpg">
                        {/if}
                      </a>

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

              <div id="itemloading"><img alt="加载中" src="%7B%24template_data%7Dimg/loading3.gif"></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><?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>

网站地址

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn