首页 > CMS > PhpCMS > 正文

【phpcms-v9】phpcms-v9中get标签调用全站文章内容

2024-09-10 07:15:58
字体:
来源:转载
供稿:网友

1.index.php控制器中添加lists_all()方法:

  1. /**  
  2.      * 此方法为自行添加,主要用来控制显示全站文章内容  
  3.      */   
  4.     public function lists_all() {   
  5.         $page = intval($_GET['page']);   
  6.         include template('content','list_all');   
  7.     } 

2.list_all.html模板文件:查询v9_news内容表中所有文章,每页显示15篇文章:

  1. <div class="wenzhangliebiaoye">   
  2.                
  3.             {pc:get sql="select * from v9_news order by id desc" num="15" page="$page"}   
  4.             {loop $data $r $val}   
  5.                 <a href="{$val[url]}">   
  6.                     <dl class="wenzhangliebiao">     
  7.                         {if $val[thumb] != "" }    
  8.                         <dt><img src="{thumb($val[thumb],132,97)}" width="132" height="97" alt="{$val[title]}"></dt>   
  9.                         {else}  //开源软件:Vevb.com 
  10.                         <dt><img src="http://www.hebei800.cn/statics/images/common_images/logo1.jpg" width="132" height="97" alt="{$val[title]}"></dt>   
  11.                         {/if}   
  12.                         <dd>   
  13.                             <h3>{$val[title]}</h3>   
  14.                             <p>{str_cut($val[description],220,'...')} </p>   
  15.                             <div><span>{date('Y年m月d日 H:i:s',$val[inputtime])}</span>     <span>{date('H:i',$val[updatetime])}更新</span></div>   
  16.                         </dd>   
  17.                     </dl>   
  18.                 </a>   
  19.             {/loop}   
  20.             {/pc}   
  21.             </div>   
  22.             <div class="clear30"></div>   
  23.             <div class="wenzhangfanye">   
  24.                 <p>   
  25.                     {$pages}   
  26.                 </p>
  27.             </div>

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表