日期:2014-05-17  浏览次数:20656 次

phpcms 2008网站建设常用代码收集
碎片:<!--{block("list_down", 1)}-->
文章摘要:     {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
设定域名:<base href="{SITE_URL}" />
栏目名称:{$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]}";<!--注意-$n要加上{}-->
picarr[{$n}] = "{$r[thumb]}";




网站热门关键词:
{get sql="select tag,hits from phpcms_keyword order by listorder desc,hits desc" rows="10"} 
<a href="tag.php?tag={urlencode($r[tag])}">{$r[tag]}</a>
{$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&