1. 程式人生 > >【phpcms-v9】phpcms-v9中get標籤呼叫全站文章內容

【phpcms-v9】phpcms-v9中get標籤呼叫全站文章內容

1.index.php控制器中新增lists_all()方法

/**
	 * 此方法為自行新增,主要用來控制顯示全站文章內容
	 */
	public function lists_all() {
		$page = intval($_GET['page']);
		include template('content','list_all');
	}

2.list_all.html模板檔案:查詢v9_news內容表中所有文章,每頁顯示15篇文章

<div class="wenzhangliebiaoye">
			
			{pc:get sql="select * from v9_news order by id desc" num="15" page="$page"}
			{loop $data $r $val}
				<a href="{$val[url]}">
					<dl class="wenzhangliebiao">	
						{if $val[thumb] != "" }	
						<dt><img src="{thumb($val[thumb],132,97)}" width="132" height="97" alt="{$val[title]}"></dt>
						{else}
						<dt><img src="http://www.hebei800.cn/statics/images/common_images/logo1.jpg" width="132" height="97" alt="{$val[title]}"></dt>
						{/if}
						<dd>
							<h3>{$val[title]}</h3>
							<p>{str_cut($val[description],220,'...')} </p>
							<div><span>{date('Y年m月d日 H:i:s',$val[inputtime])}</span>     <span>{date('H:i',$val[updatetime])}更新</span></div>
						</dd>
					</dl>
				</a>
			{/loop}
			{/pc}
			</div>
			<div class="clear30"></div>
			<div class="wenzhangfanye">
				<p>
					{$pages}
				</p>
				
				
					
			</div>

參考:http://www.zhen.com/lists_all/  效果