<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ## 文章列表 文章列表的應用場景對于一個站點來講是必不可少的,主要包括以下一種場景。 * 指定數量的文章列表,用于首頁等調用 * 帶分頁的文章列表,用于文章列表頁使用 * 圖文混排的列表頁面 ## 標簽庫的加載 由于CMF5在設計過程中采用了前端portal完全獨立,所以在文章列表中使用的標簽需要單獨來進行引用才能使用。 加載標簽庫代碼如下,一般建議在head里引用,一次引用就都能用了,當然如果你想每個頁面單獨引用或者寫在前端Portal的配置文件里也是可以的。 ~~~ <taglib name="app\portal\taglib\Portal"/> ~~~ ## articles標簽 | 標簽名 | 作用 | 包含屬性 | | --- | --- | --- | | articles | 獲取文章列表 | field,where,limit,order,page,relation,pageVarName,categoryIds,item | 標簽屬性: | 標簽屬性名 | 含義 | | --- | --- | | where | 查詢條件變量, 支持數組和字符串,如`$where` | | limit | 最多查出文章數,如果分頁開啟,此設置無效 | | order | 文章排序方式 | | page | 分頁參數,如果設置分頁參數會自動分頁 | | relation | 關聯查詢,支持`categories`和`user`,多個以英文逗號分隔 | | pageVarName | 分頁后生成的分頁變量名,只有設置分頁參數時才有效 | | categoryIds | 分類 id,支持數組和字符串(英文逗號分開)| ## 生成文章列表 ### 一個最新文章列表,不分頁 ``` <portal:articles limit="5" order="post.published_time DESC" categoryIds="$widget.vars.last_articles_category_id"> <dl class="dl-horizontal"> <dt> <a class="img-wraper" href="{:url('portal/article/index',array('id'=>$vo.id,'cid'=>$vo.category_id))}"> <if condition="empty($vo.more.thumbnail)"> <img src="__TMPL__/public/assets/images/default_tupian4.png" class="img-responsive" alt="{$vo.post_title}"/> <else/> <img src="__TMPL__/public/assets/images/default_tupian4.png" class="img-responsive" alt="{$vo.post_title}"/> </if> </a> </dt> <dd> <a href="{:url('portal/article/index',array('id'=>$vo['id'],'cid'=>$vo.category_id))}">{$vo.post_title}</a> </dd> </dl> </portal:articles> ``` ### 一個文章列表,分頁 ```html <div> <php> $where=[ 'post.create_time'=>['egt',0] ]; </php> <portal:articles item="vo" field="" where="$where" order="post.published_time DESC" page="10" relation="categories" categoryIds="$category.id" returnVarName="articles_data"> <div class="list-boxes"> <h2><a href="{:url('article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}">{$vo.post_title}</a> </h2> <p>{$vo.post_excerpt}</p> <div> <div class="pull-left"> <div class="list-actions"> <a href="javascript:;"><i class="fa fa-eye"></i><span>{$vo.post_hits}</span></a> <a href="{:url('article/doLike',array('id'=>$vo['id']))}" class="js-count-btn"><i class="fa fa-thumbs-up"></i><span class="count">{$vo.post_like}</span></a> <a href="{:url('user/favorite/add',array('id'=>$vo['id']))}" class="js-favorite-btn" data-title="{$vo.post_title}" data-url="{:url('portal/article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}" > <i class="fa fa-star-o"></i> </a> </div> </div> <a class="btn btn-warning btn-sm pull-right" href="{:url('article/index',array('id'=>$vo['id'],'cid'=>$category['id']))}">查看更多</a> </div> </div> </portal:articles> </div> <ul class="pagination"> <page/> </ul> ``` 其中顯示字段( field="" )建議按需填寫,CMF默認是空,即顯示所有字段數據。CMF中,articles標簽默認調用3個表數據,分別為post表,category_post表,user表。默認獲取的字段為post.*,user.user_login,user.user_nickname,user.user_email,category_post.category_id這幾個,如果你需要其他的字段,則需要加上表名,如排序字段則需要category_post.list_order 比如你的列表只要顯示標題和日期,那么只需要寫成 ~~~ field="post.id,post.post_title,post.published_time" ~~~ 常用列表數據有 ~~~ {$vo.id} //文章ID號 {$vo.user_id} //文章作者ID {$vo.user_nickname} //文章作者昵稱 {$vo.user_login} //文章作者用戶名 {$vo.is_top} //是否置頂,0未置頂,1置頂 {$vo.post_status} //文章狀態,0未發布,1發布 {$vo.recommended} //是否推薦,0未推薦,1推薦 {$vo.post_hits} //文章訪問量 {$vo.post_like} //文章點贊量 {$vo.create_time} //文章創建時間 {$vo.update_time} //文章更新時間 {$vo.published_time} //文章發布時間 {$vo.published_time} //文章發布時間 {$vo.post_title} //文章標題 {$vo.post_keywords} //文章關鍵詞 {$vo.post_excerpt} //文章簡短描述 {$vo.post_source} //文章來源 {$vo.post_content} //文章詳細內容 {$vo['more']['thumbnail']} //文章縮略圖 {$vo['more']['photos']} //相冊圖集 {$vo['more']['files']} //文章附件 ~~~ >所有日期均要使用{:date('Y-m-d H:i',$vo.published_time)}這種方式來獲取。數據庫默認存的是int型時間戳。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看