文章列表页制作

可用变量

  1. {$term_id}<br><!--分类id-->
  2. {$cat_id}<br><!--分类id,同上-->
  3. {$name}<br><!--分类名称-->
  4. {$taxonomy}<br><!--分类的类型,用字符串表示,article表示文章-->
  5. {$description}<br><!--分类描述-->
  6. {$parent}<br><!--分类父级id,terms表中的term_id-->
  7. {$seo_title}<br>
  8. {$seo_keywords}<br>
  9. {$seo_description}<br>
  10. {$list_tpl}<br><!--分类列表页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为list-->
  11. {$one_tpl}<br><!--分类单文章页的模板,对应于模板目录下Portal/文件名+.html,文件名默认为article-->

例子:

  1. <php>
  2. $lists = sp_sql_posts_paged("cid:$cat_id;order:post_date DESC;",10);
  3. </php>
  4. <volist name="lists['posts']" id="vo">
  5. <php>
  6. $smeta=json_decode($vo['smeta'], true);
  7. </php>
  8. <div class="list-boxes">
  9. <h2><a href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}">{$vo.post_title}</a></h2>
  10. <p>{$vo.post_excerpt}</p>
  11. <div>
  12. <div class="pull-left">
  13. <div class="list-actions">
  14. <a href="javascript:;"><i class="fa fa-eye"></i><span>{$vo.post_hits}</span></a>
  15. <a href="{:U('article/do_like',array('id'=>$vo['object_id']))}" class="js-count-btn"><i class="fa fa-thumbs-up"></i><span class="count">{$vo.post_like}</span></a>
  16. <a href="{:U('user/favorite/do_favorite',array('id'=>$vo['object_id']))}" class="js-favorite-btn" data-title="{$vo.post_title}" data-url="{:U('portal/article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}" data-key="{:sp_get_favorite_key('posts',$vo['object_id'])}">i class="fa fa-star-o"></i></a>
  17. </div>
  18. </div>
  19. <a class="btn btn-warning pull-right" href="{:leuu('article/index',array('id'=>$vo['object_id'],'cid'=>$vo['term_id']))}">查看更多</a>
  20. </div>
  21. </div>
  22. </volist>
  23. <div class="pagination">
  24. <ul>
  25. {$lists['page']}
  26. </ul>
  27. </div>