phpcms 2008網站建設慣用代碼收集

來源:互聯網
上載者:User
phpcms 2008網站建設常用代碼收集
片段:
文章摘要: {str_cut($r[description],xx,'...')}
文章網址: {$r[url]}
文章標題: {$r[title]} {str_cut($r[title],44,'')}
文章時間:{date('Y-m-d', $r[updatetime])}
模板路徑:{SKIN_PATH}
調用頭部頁面 :{template 'phpcms','header'}
商務通連結網址:/swt/go.php?from=xxx
設定網域名稱:
欄目名稱:{$catname}
欄目+列表當前位置:{catpos($catid)}
文章頁面當前位置:{catpos($r['catid'])}
tag_標籤內容列表
select * from `phpcms_content` a,`phpcms_content_tag` k where a.contentid=k.contentid and a.status=99 and k.tag='$tag' order by a.contentid desc
===============================================
category.html常用標籤:
==============================================
調用欄目網址:{$CATEGORY[$catid][url]} {$CATEGORY[112][url]}
調用欄目名稱:{$CATEGORY[$catid][catname]} {$CATEGORY[112][catname]}
調用熱點文章(按每月點擊次數排序):
{get sql=" SELECT a.* FROM `phpcms_content` a, `phpcms_content_count` p WHERE a.contentid=p.contentid AND a.status=99 ORDER BY p.hits_month DESC limit 2,5" }


調用分類ID為36的一條新聞文章1條:
{get sql="select * from `phpcms_content` where status=99 and catid=36 ORDER BY updatetime DESC limit 0,1"}


調用某個欄目下的普通文章5條,並分頁顯示:
{get sql="select * from `phpcms_content` where status=99 and catid=80 ORDER BY updatetime DESC" rows="5" page="$pages"}


調用縮圖文章1條:
{get sql="select title,url,thumb,description from `phpcms_content` where status=99 and thumb!='' and catid=xxxx ORDER BY updatetime DESC limit 0,1" } {$r[thumb]}
--------------------------------------------------
index.html常用標籤:
----------------------------------------------------
友情連結:
{get sql="select * from `phpcms_link`where passed=1 order by listorder"}
連結網址: {$r[url]}
連結名:{$r[name]}


投影片:
{get sql="SELECT a.title,a.url,a.thumb FROM `phpcms_content` a, `phpcms_content_position` p WHERE a.contentid=p.contentid AND p.posid=2 AND a.status=99 AND `thumb`!='' ORDER BY a.contentid DESC"}
linkarr[{$n}] = "{$r[url]}";
picarr[{$n}] = "{$r[thumb]}";




網站熱門關鍵詞:
{get sql="select tag,hits from phpcms_keyword order by listorder desc,hits desc" rows="10"}
{$r[tag]}
{$r[hits]}
{/get}


擷取父欄目下的子級欄目:


{get sql="select * from `phpcms_category` where parentid =$catid order by listorder"}

{get sql="select * from `phpcms_content` where status=99 and catid = $r[catid] ORDER BY updatetime DESC" rows="4" return="ar"}
欄目連結網址 {$ar[url]}
欄目名稱 {$ar[catname]}
{/get}
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
list.html 常用標籤:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
當前欄目文章每頁分10條的分頁代碼
{get sql="select * from `phpcms_content` where catid = $catid and status=99 order by updatetime desc" rows="10" page="$pages" }


分頁:{$pages}


推薦閱讀;首頁推薦posid=1 首頁焦點posid=2 首頁頭條posid=3 列表頁推薦posid=4 內容頁推薦posid=5


{get sql="SELECT a.* FROM `phpcms_content` a, `phpcms_content_position` p WHERE a.contentid=p.contentid AND p.posid=1 AND a.status=99 AND a.catid=39 order by updatetime desc" rows="1"}
{/get}




4、自訂返回變數,樣本(調用欄目ID為1通過審核的10條資訊,標題長度不超過25個漢字,顯示更新日期,返回變數為 $v):


{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10" return="v"}標題:{str_cut($v[title], 50)} URL:{$v[url]} 更新日期:{date('Y-m-d', $v[updatetime])} {/get}


5、調用同一帳號下的其他資料庫,樣本(調用資料庫為bbs,分類ID為1的10個最新主題,主題長度不超過25個漢字,顯示更新日期):{get dbname="bbs" sql="select * from cdb_threads where fid=1 order by dateline desc" rows="10"}主題:{str_cut($r[subject], 50)} URL:http://bbs.phpcms.cn/viewthread.php?tid={$r[tid]} 更新日期:{date('Y-m-d', $r[dateline])} {/get}


6、調用外部資料,樣本(調用資料來源為bbs,分類ID為1的10個最新主題,主題長度不超過25個漢字,顯示更新日期):{get dbsource="bbs" sql="select * from cdb_threads where fid=1 order by dateline desc" rows="10"}主題:{str_cut($r[subject], 50)} URL:http://bbs.phpcms.cn/viewthread.php?tid={$r[tid]} 更新日期:{date('Y-m-d', $r[dateline])} {/get}


7、調用ecshop資料,樣本(調用資料來源為ecshop,調用產品庫中最新的5個產品):{get dbsource="ecshop" sql="SELECT `goods_id`,`goods_name`,`goods_thumb` FROM `ecs_goods` ORDER BY `goods_id` DESC" rows="5" }產品ID:{$r[goods_id]} 名稱:{$r[goods_name]} 產品圖片:{$r[goods_thumb]} {/get}


擷取當前大欄目 下的各個小欄目的文章;

{get sql="select * from `phpcms_content` where status=99 and catid in($arrchildid1) ORDER BY inputtime asc" rows="1"}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
show.html頁面標籤:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
文章標題:{if $titleintact}{$titleintact}{else}{$title}{/if}
文章來源:{$copyfrom}
文章作者:{$author}
更新時間:{date('Y-m-d', $r[updatetime])}
文章內容:{$content}
上一篇:
{get sql="SELECT * FROM `phpcms_content` WHERE `contentid` < '$contentid' and status = 99 ORDER BY inputtime DESC" rows="1"}
{$r[title]}


下一篇:
{get sql="SELECT * FROM `phpcms_content` WHERE `contentid` > '$contentid' and status = 99 ORDER BY inputtime DESC" rows="1"}
{$r[title]}
相關文章:
{get sql="select * from `phpcms_content` where status=99 and catid=$catid ORDER BY updatetime DESC limit 0,10"}
本文標籤/關鍵字:
{get sql="SELECT p.tag FROM `phpcms_content` a, `phpcms_content_tag` p WHERE a.contentid=p.contentid AND a.status=99 order by updatetime desc" rows="1"}

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.