重庆小潘seo博客

当前位置:首页 > 重庆网络营销 > 小潘杂谈 >

小潘杂谈

phpcms标签如何使用?

时间:2020-09-04 10:30:08 作者:重庆seo小潘 来源:
phpcms标签的使用: 1、显示指定catid的栏目名称和链接 {$CATEGORYS[25][catname]}{$CATEGORYS[25][url]} 获取父栏目id,获取父栏目名称$CATEGORY[$catid][parentid]}父栏目名称:{$CATEGORYS[$CAT[parentid]][catname]} 去掉标题限制后出现的省略号{str_cut

phpcms标签如何使用?

phpcms标签的使用:

1、显示指定catid的栏目名称和链接 {$CATEGORYS[25]['catname']}{$CATEGORYS[25]['url']}

获取父栏目id,获取父栏目名称$CATEGORY[$catid][parentid]}父栏目名称:{$CATEGORYS[$CAT[parentid]][catname]}

去掉标题限制后出现的省略号{str_cut($r[title],36,'...')}格式化时间 2011-05-06 11:22:33{date('Y-m-d H:i:s',$r[inputtime])}{date('Y年m月d日',$r[inputtime])}2、调用子栏目(在栏目首页模板需要用到,列表页也可以用到){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"表示主副表关联起来 可以直接使用{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]}来源:{$r[copyfrom]}点击率{$r[readpoint]}网址{$r[url]}文章标题 {$r['title']}标题样式{title_style($v[style])}{/loop}{/pc}<p>=====================</p(2)sql万能语句可以调用指定内容 更方便{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 alt="phpcms标签如何使用?" 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)文章从指定位置开始调用 (position推荐位使用)

起始位置为5,调用3条。相当于limit功能。{pc:contentaction="position" posid="27" order="listorder DESC" num="3" start="5"}{loop $info $r}<ahref='{$r[url]}'>{str_cut($r[description],115)}... </a>{/loop}{/pc} 或{pc:contentaction="lists"catid="54"thumb=""order="listorder DESC"start="3" num="5"} thumb="" 不分类<p>=====================</p>循环列表新闻<div>(4)有分页效果{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>4、<!--首页焦点图推荐 就图片切换那个东西-->{pc:contentaction="position" posid="1"order="listorder DESC" thumb="1" num="5"} {loop $data $r}<a href="{$r['url']}" title="{str_cut($r['title'],30)}"><img alt="phpcms标签如何使用?" src="{thumb($r['thumb'],300,200)}" alt="{$r['title']}" width="310" height="260" /></a>{/loop}{/pc}5、分页

前台调用num="50"指每页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>以上就是phpcms标签如何使用?的详细内容,更多请关注小潘博客其它相关文章!