搜尋
首頁後端開發php教程phpcms 2008网站建设惯用代码收集

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`


下一篇:
{get sql="SELECT * FROM `phpcms_content` WHERE `contentid` > '$contentid' and status = 99 ORDER BY inputtime DESC" rows="1"}

相关文章:
 {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"}

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
PHP和Python:解釋了不同的範例PHP和Python:解釋了不同的範例Apr 18, 2025 am 12:26 AM

PHP主要是過程式編程,但也支持面向對象編程(OOP);Python支持多種範式,包括OOP、函數式和過程式編程。 PHP適合web開發,Python適用於多種應用,如數據分析和機器學習。

PHP和Python:深入了解他們的歷史PHP和Python:深入了解他們的歷史Apr 18, 2025 am 12:25 AM

PHP起源於1994年,由RasmusLerdorf開發,最初用於跟踪網站訪問者,逐漸演變為服務器端腳本語言,廣泛應用於網頁開發。 Python由GuidovanRossum於1980年代末開發,1991年首次發布,強調代碼可讀性和簡潔性,適用於科學計算、數據分析等領域。

在PHP和Python之間進行選擇:指南在PHP和Python之間進行選擇:指南Apr 18, 2025 am 12:24 AM

PHP適合網頁開發和快速原型開發,Python適用於數據科學和機器學習。 1.PHP用於動態網頁開發,語法簡單,適合快速開發。 2.Python語法簡潔,適用於多領域,庫生態系統強大。

PHP和框架:現代化語言PHP和框架:現代化語言Apr 18, 2025 am 12:14 AM

PHP在現代化進程中仍然重要,因為它支持大量網站和應用,並通過框架適應開發需求。 1.PHP7提升了性能並引入了新功能。 2.現代框架如Laravel、Symfony和CodeIgniter簡化開發,提高代碼質量。 3.性能優化和最佳實踐進一步提升應用效率。

PHP的影響:網絡開發及以後PHP的影響:網絡開發及以後Apr 18, 2025 am 12:10 AM

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP類型提示如何起作用,包括標量類型,返回類型,聯合類型和無效類型?PHP類型提示如何起作用,包括標量類型,返回類型,聯合類型和無效類型?Apr 17, 2025 am 12:25 AM

PHP類型提示提升代碼質量和可讀性。 1)標量類型提示:自PHP7.0起,允許在函數參數中指定基本數據類型,如int、float等。 2)返回類型提示:確保函數返回值類型的一致性。 3)聯合類型提示:自PHP8.0起,允許在函數參數或返回值中指定多個類型。 4)可空類型提示:允許包含null值,處理可能返回空值的函數。

PHP如何處理對象克隆(克隆關鍵字)和__clone魔法方法?PHP如何處理對象克隆(克隆關鍵字)和__clone魔法方法?Apr 17, 2025 am 12:24 AM

PHP中使用clone關鍵字創建對象副本,並通過\_\_clone魔法方法定制克隆行為。 1.使用clone關鍵字進行淺拷貝,克隆對象的屬性但不克隆對象屬性內的對象。 2.通過\_\_clone方法可以深拷貝嵌套對象,避免淺拷貝問題。 3.注意避免克隆中的循環引用和性能問題,優化克隆操作以提高效率。

PHP與Python:用例和應用程序PHP與Python:用例和應用程序Apr 17, 2025 am 12:23 AM

PHP適用於Web開發和內容管理系統,Python適合數據科學、機器學習和自動化腳本。 1.PHP在構建快速、可擴展的網站和應用程序方面表現出色,常用於WordPress等CMS。 2.Python在數據科學和機器學習領域表現卓越,擁有豐富的庫如NumPy和TensorFlow。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
1 個月前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
1 個月前By尊渡假赌尊渡假赌尊渡假赌
威爾R.E.P.O.有交叉遊戲嗎?
1 個月前By尊渡假赌尊渡假赌尊渡假赌

熱工具

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

Atom編輯器mac版下載

Atom編輯器mac版下載

最受歡迎的的開源編輯器

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。