本篇文章給大家分享的是有關(guān)如何使用phpcms標(biāo)簽,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。

成都創(chuàng)新互聯(lián)公司是一家專業(yè)從事成都網(wǎng)站建設(shè)、網(wǎng)站制作、網(wǎng)頁(yè)設(shè)計(jì)的品牌網(wǎng)絡(luò)公司。如今是成都地區(qū)具影響力的網(wǎng)站設(shè)計(jì)公司,作為專業(yè)的成都網(wǎng)站建設(shè)公司,成都創(chuàng)新互聯(lián)公司依托強(qiáng)大的技術(shù)實(shí)力、以及多年的網(wǎng)站運(yùn)營(yíng)經(jīng)驗(yàn),為您提供專業(yè)的成都網(wǎng)站建設(shè)、營(yíng)銷型網(wǎng)站建設(shè)及網(wǎng)站設(shè)計(jì)開(kāi)發(fā)服務(wù)!
phpcms標(biāo)簽的用法:1、顯示指定catid的欄目名稱和鏈接;2、調(diào)用子欄目;3、得到指定欄目下的新聞;4、實(shí)現(xiàn)分頁(yè)功能。
phpcms標(biāo)簽的使用:
1、顯示指定catid的欄目名稱和鏈接{$CATEGORYS[25]['catname']} {$CATEGORYS[25]['url']}
獲取父欄目id,獲取父欄目名稱 $CATEGORY[$catid][parentid]} 父欄目名稱:{$CATEGORYS[$CAT[parentid]][catname]}
去掉標(biāo)題限制后出現(xiàn)的省略號(hào)
{str_cut($r[title],36,'...')}格式化時(shí)間 2011-05-06 11:22:33
{date('Y-m-d H:i:s',$r[inputtime])}
{date('Y年m月d日',$r[inputtime])}2、調(diào)用子欄目(在欄目首頁(yè)模板需要用到,列表頁(yè)也可以用到)
{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<a href="{$r[url]}">{$r[catname]}</a> |
{/loop}{/pc}3、得到指定欄目下的新聞
(1)這里moreinfo="1"表示主副表關(guān)聯(lián)起來(lái) 可以直接使用
{pc:content action="lists" catid="$catid" num="25" order="id DESC" return="info" moreinfo="1"}
{loop $info $r}
更新日期:{date('Y年m月d日',$r[updatetime])}
作者:{$r[username]}
來(lái)源:{$r[copyfrom]}
點(diǎn)擊率{$r[readpoint]}
網(wǎng)址{$r[url]}
文章標(biāo)題 {$r['title']}
標(biāo)題樣式{title_style($v[style])}
{/loop}
{/pc}
<p>=====================</p(2)sql萬(wàn)能語(yǔ)句可以調(diào)用指定內(nèi)容 更方便
{pc:get sql="select * from v9_news as a,v9_news_data as b where a.id=b.id and catid=34 and status=99 order by a.id desc"}
{loop $data $v}
<li><a href="{$v['url']}" target="_blank"><img src="{$v[thumb]}" width="146" height="117" /></a></li>
{/loop}
{/pc}
{pc:get sql="select * from v9_news where catid=10 and status=99 order by updatetime desc" num="5" start="23"}
{loop $data $rs}
<a href="{$rs['url']}" title="{$rs['title']}" target="_blank">{$rs['title']}</a>
{/loop}
{/pc}
<p>=====================</p(3)文章從指定位置開(kāi)始調(diào)用 (position推薦位使用)
起始位置為5,調(diào)用3條。相當(dāng)于limit功能。
{pc:content action="position" posid="27" order="listorder DESC" num="3" start="5"}
{loop $info $r}
<a href='{$r[url]}'>{str_cut($r[description],115)}... </a>
{/loop}
{/pc}
或{pc:content action="lists" catid="54" thumb="" order="listorder DESC" start="3" num="5"} thumb="" 不分類
<p>=====================</p>循環(huán)列表新聞
<div class="content">
{pc:content action="position" posid="9" order="listorder DESC" num="4"}
{loop $data $r}
<a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],36,'')}</a>{date('Y-m-d H:i:s',$r[inputtime])}
<p>{if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>{/if}{str_cut($r[description],112,'')}<a href="{$r[url]}">[reading more]</a></p>
{/loop}
{/pc}
</div>
<p>=====================</p>(4)有分頁(yè)效果
{pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"}
<ul >
{loop $data $r}
<li><span class="left">·<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(編輯:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li>
<?php
if($n%5==0 and $n<50) echo "</ul><ul>";
?>
{/loop}
</ul>
</div>
<div id="pages" class="text-c">{$pages}</div>
{/pc}4、<!--首頁(yè)焦點(diǎn)圖推薦 就圖片切換那個(gè)東西-->
{pc:content action="position" posid="1" order="listorder DESC" thumb="1" num="5"}
{loop $data $r}
<a href="{$r['url']}" title="{str_cut($r['title'],30)}"><img src="{thumb($r['thumb'],300,200)}" alt="{$r['title']}" width="310" height="260" /></a>
{/loop}
{/pc}5、分頁(yè)
前臺(tái)調(diào)用num="50"指每頁(yè)50條記錄
{pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"}
<ul >
{loop $data $r}
<li><span class="left">·<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(編輯:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li>
<?php
if($n%5==0 and $n<50) echo "</ul><ul>";
?>
{/loop}
</ul>
</div>
<div id="pages" class="text-c">{$pages}</div>
{/pc}以上就是如何使用phpcms標(biāo)簽,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
名稱欄目:如何使用phpcms標(biāo)簽
轉(zhuǎn)載注明:http://chinadenli.net/article34/gogdpe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、網(wǎng)站設(shè)計(jì)、微信公眾號(hào)、自適應(yīng)網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)公司、云服務(wù)器
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)