建站软件 优化软件 编程软件 网页辅助 站群程序 网站程序 图像处理 资源教程 字体下载 推荐软件


您的位置:首页 > 建站必知 > phpcms模板标签get等用法

phpcms模板标签get等用法

时间:2015-07-16 16:28:52  来源:免费模板网 作者:风雪 阅读次数 tagsphpcms

我们在使用phpcms做网站的时候,经常会要对模板里面的一些标签要进行修改。那么模板里面经常会用到哪些标签呢,小班为您准备了一些常用的,请看下文

1、调用本系统单条数据,示例(调用ID为1的信息,标题长度不超过25个汉字,显示更新日期): 

{get sql="select * from phpcms_content where contentid=1" /} 
标题:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])} 
2、调用本系统多条数据,示例(调用栏目ID为1通过审核的10条信息,标题长度不超过25个汉字,显示更新日期): 
{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10"} 
标题:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])} 
{/get} 
3、带分页,示例(调用栏目ID为1通过审核的10条信息,标题长度不超过25个汉字,显示更新日期,带分页): 
{get sql="select * from phpcms_content where catid=1 and status=99 order by updatetime desc" rows="10" page="$page"} 
标题:{str_cut($r[title], 50)} URL:{$r[url]} 更新日期:{date('Y-m-d', $r[updatetime])} 
{/get} 
分页:{$pages} 
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} 

不知道有没有朋友在使用中遇到这几种方法不能满足需求的时候呢? 

本文地址:https://www.freemoban.com/jzbz/2015/0716/2315.html

猜你喜欢
栏目推荐
模板推荐

Copyright:www.freemoban.com 免费模板网 All Rights Reserved 网站备案:辽ICP备19014872号-2   辽公网安备 21010602000376号  辽公网安备:42900402000182号

免责声明:本站部分资源来自互联网收集,版权归原创者所有,如果侵犯了你的权益,我们会及时删除侵权内容,联系QQ:1615187561 谢谢合作!