phpcms v9 常用调用标签(全)
本文介绍phpcms v9中模板标签使用说明。
{template "content","header"}
调用根目录下phpcms\template\content\header文件
{CHARSET}
字符集 (gbk或者utf-)
{if isset($SEO['title']) && !empty($SEO['title'])}
{$SEO['title']}{/if}
{$SEO['site_title']}
{$SEO['keyword']}
{$SEO['description']}
标题和标题seo优化
{CSS_PATH}
地址替换为根目录下\statics\css
{JS_PATH}
地址替换为根目录下\statics\js
{pc:content action="position" posid="" order="id" num="" cache=""}
pc标签{pc:content 参数名="参数值"参数名="参数值"参数名="参数值"}
{loop $data $k $v}
{$v[title]} {/loop}
pc标签值
action="position"--------------对话框的类型=“内容推荐位列表”
posid=""----------------------推荐位ID=""
order="id"---------------------排序类型="id"
num="" ----------------------数据调用数量=""
cache=""-------------------缓存=""毫秒
{get_siteid()}
{IMG_PATH}
action="hits" 排行,热点等
action="lists" 主要用于列表等。
catid="$catid" 当前栏目ID 指定数字,即为指定的栏目
num="" 调用文章的数量
order="id DESC" 按ID降序排列
order="id ASC" 按ID升序排列
"views DESC"
sort=""
"" 缩略图
return=""
page="$page" 需要分页
每当列表几行的时候出现一次这个
{if $num%==} {/if}
循环标签
{loop $data $r} {/loop}
{loop $info $r} {/loop}
日期-------------{date('Y-m-d H:i:s',$r[inputtime])}
文章链接------{$r[url]}
文章标题------{$r[title]}
标题截取------{str_cut($r[title],,'...')}
缩略图---------loop是info的时候用 {thumb($r[thumb],,)} loop是data的时候用{thumb($v[thumb],,)}
分页标签------{$pages}
文章页标签
标题-------{$title}
内容-------{$content}
日期-------{$inputtime}
来源-------{$copyfrom}
点击数------ 网站首页----------------{siteurl($siteid)}
当前位置----------------{catpos($catid)}
栏目名称----------------{$CAT[catname]}
栏目拼音----------------{$CAT[letter]}
栏目链接----------------{$CAT[url]}
父栏目名称--------------{$CATEGORYS[$CAT[parentid]][catname]}
父栏目链接--------------{$CATEGORYS[$CAT[parentid]][url]}
上上级栏目名称--------{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][catname]}
上上级栏目链接--------{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][url]}
一级父栏目列表
{pc:content action="category" catid="" num="" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{$r[catname]}
{/loop}
{/pc}
同级栏目列表
{pc:content action="category" catid="$parentid" num="" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{$r[catname]}
{/loop}
{/pc}
组图列表
{loop $photos $r}
{$r[alt]}
{/loop}
注释:其中$photos为自定义组图字段,{$r[url]}为图片地址,{thumb($r[url], , , )}为图片缩略图,{$r[alt]}为图片描述
两表联合查询
{pc:get sql="select * from `v9_table1` as a left join `v9_table2` as b on a.id = b.id where 查询条件 order by listorder DESC" return="data"}
{/pc}
三表联合查询
{pc:get sql="select * from `v9_table1` as a left join(`v9_table2` as b left join `v9_table3` as c on b.id = c. id) on a.id = b.id where 查询条件 order by listorder DESC" return="data“}
{/pc}
首页调用
、V9同时调用多个栏目最新文章标签
{pc:get sql="SELECT `n`.`inputtime`,`n`.`url`,`n`.`title`,`c`.`catname`,`c`.`url` as `c_url` FROM `v9_news` as `n` left
join `v9_category` as `c` on `n`.`catid` = `c`.`catid` where `c`.`catid` in (,,,,) order by `n`.`id` desc" num=""
cache="" page="" dbsource="" return="data"}
{loop $data $key $val}
{date('Y-m-d H:i:s',$val[inputtime])}[{$val [catname]}] {$val[title]}
{/loop}
{/pc}
{pc:get sql=”select * from anzhi where catid=’cid’”}
{loop $data $r}
{/loop}
{/pc}
、首页头条
{pc:content action="position" posid="" order="listorder DESC" num=""}
{loop $data $r}
{str_cut($r[title],,'')}
{str_cut($r[description],)}
{/loop}
{/pc}
调用4个
{pc:content action="position" posid="" order="listorder DESC" num=""}
{loop $data $r}
{str_cut($r[title],,'')}
{if $n==}phpcms <wbr>v9 <wbr>常用调用标签(全){/if}{str_cut($r[description],)}
{/loop}
{/pc}
、调用某栏目最新文章
{pc:content action="lists" catid="" order="id DESC" num=""cache=""}
{loop $data $r}
{$r[title]}
{/loop}
{/pc}
、调用图文
图片新闻
{pc:content action="position" posid="" thumb="" order="listorder DESC" num=""}
{loop $data $r}
phpcms <wbr>v9 <wbr>常用调用标签(全)
{str_cut($r[title],)}
{/loop}
{/pc}
、外部数据源调用
{pc:get sql="SELECT * FROM pre_forum_thread" cache="" dbsource="discuz" return="data" num=""}
、指定变量循环增长(幻灯片调用)
{pc:content action="position" posid="" order="listorder DESC" thumb="" num=""}
{loop $data $r}
{$r['title']}
{/loop}
{/pc}
{pc:content action="lists" catid="" order="listorder DESC" thumb="" num="" }
{php $num = }
{loop $data $r}
linkarr[{$num}] = "{$r[url]}";
picarr[{$num}] = "{$r[thumb]}";
textarr[{$num}] = "{str_cut($r[title],36,'')}";
{php $num++}
{/loop}
{/pc}
、调用文字友情链接
{pc:link action="type_list" siteid="$siteid" order="listorder DESC" num="" return="dat"}
{loop $dat $v}
{$v[name]} |
{/loop}
{/pc}
、调用图片友情链接
{pc:link action="type_list" siteid="$siteid" linktype="" order="listorder DESC" num=""
return="pic_link"}
{loop $pic_link $v}
phpcms <wbr>v9 <wbr>常用调用标签(全) />
{/loop}
{/pc} 二、内容页调用
模块名:content
模块提供的可用操作
操作名 说明
lists 内容数据列表
relation 内容相关文章
hits 内容数据点击排行榜
category 内容栏目列表
position 内容推荐位列表
position操作说明如下:
--------------------------------------------------------------------------------
、内容推荐位列表(position):
可用参数:
参数名 是否必须 默认值 说明
posid 是 null 推荐位ID
catid 否 null 调用栏目ID
thumb 否 是否仅必须缩略图
order 否 null 排序类型
num 是 null 数据调用数量
代码例子:
{pc:content action="position" posid="" order="listorder DESC" num=""}
{loop $data $key $val}
{$val['title']}
{/loop}
{/pc}
返回参数如下表:
字段 类型 空 默认 注释
title char() 否 NULL 推荐位标题
url char 否 NULL 推荐位链接地址
inputtime int() 否 NULL 推荐位发布时间
thumb char 是 NULL 推荐位缩略图
其他 不定 是 根据模型所设置的加入到推荐位中字段名称
--------------------------------------------------------------------------------
、内容列表(lists):
可用参数:
参数名 是否必须 默认值 说明
catid 否 null 调用栏目ID
thumb 否 是否仅必须缩略图
order 否 null 排序类型
num 是 null 数据调用数量
代码例子:
{pc:content action="lists" catid="" order="id DESC" num=""}
{loop $data $key $val}
{$val['title']}
{/loop}
{/pc}
返回参数如下表:
字段 类型 空 默认 注释
title char() 否 NULL 推荐位标题
url char 否 NULL 推荐位链接地址
inputtime int() 否 NULL 推荐位发布时间
thumb char 是 NULL 推荐位缩略图
其他 不定 是 其他模型字段
--------------------------------------------------------------------------------
、点击排行榜(hits):
可用参数:
参数名 是否必须 默认值 说明
catid 否 null 调用栏目ID
day 否 调用多少天内的排行
order 否 null 排序类型(本月排行- monthviews DESC 、本周排行 - weekviews DESC、今日排行 - dayviews DESC)
num 是 null 数据调用数量
代码例子:
{pc:content action="hits" catid="" order="weekviews DESC" num=""}
{loop $data $key $val}
{$val['title']}
{/loop}
{/pc}
返回参数如下表:
字段 类型 空 默认 注释
title char() 否 NULL 推荐位标题
url char 否 NULL 推荐位链接地址
inputtime int() 否 NULL 推荐位发布时间
thumb char 是 NULL 推荐位缩略图
其他 不定 是 其他模型字段
-------------------------------------------------------------------------------
、相关文章(relation):
可用参数:
参数名 是否必须 默认值 说明
catid 否 null 调用栏目ID
relation 否 $relation 无需更改
keywords 否 null 内容页面取值:$rs[keywords]
num 是 null 数据调用数量
代码例子:
{pc:content action="relation" relation="$relation" catid="$catid" num="" keywords="$rs[keywords]"}
{loop $data $r}
{$r[title]}({date('Y-m-d',$r[inputtime])}) {/loop}
{/pc}
返回参数如下表:
字段 类型 空 默认 注释
title char() 否 NULL 推荐位标题
url char 否 NULL 推荐位链接地址
inputtime int() 否 NULL 推荐位发布时间
thumb char 是 NULL 推荐位缩略图
其他 不定 是 其他模型字段
--------------------------------------------------------------------------------
、栏目列表(category):
可用参数:
参数名 是否必须 默认值 说明
catid 否 调用该栏目下的所有栏目 ,默认0,调用一级栏目
$siteid 否 默认调用系统站点
order 否 null 排序方式、一般按照listorder ASC排序,即栏目的添加顺序
num 是 null 数据调用数量
代码例子:
{pc:content action="category" catid="" num="" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{$r[catname]}
{/loop}
{/pc}
返回参数如下表:
字段 类型 默认值 说明
catid smallint 无 栏目ID
siteid tinyint() 站点ID
module varchar() 无 模块ID
type tinyint() 栏目类型ID
modelid tinyint() 模型ID
parentid smallint() 上级父栏目
arrparentid varchar() 无 所有父栏目
child tinyint() 子栏目
arrchildid mediumtext 无 所有子栏目
catname varchar() 无 栏目名称
image varchar() 无 栏目图片
description mediumtext 无 栏目描述
parentdir varchar() 无 父栏目目录
catdir varchar() 无 栏目目录
url varchar() 无 栏目链接
items mediumint() 栏目内容数
hits int() 点击数
setting mediumtext 无 栏目设置
listorder smallint() 排序
ismenu tinyint() 是否显示
sethtml tinyint() 是否生成到根目录
letter varchar() 无 栏目拼音
phpcms v9 常用调用标签(全)的更多相关文章
- phpcms v9 get调用标签整理
常见的phpcms标签调用 1.调用本系统单条数据(调用ID为1的信息,标题长度不超过25个汉字,显示更新日期): "select * from phpcms_content where ...
- phpcms V9 常用的调用标签
本文介绍phpcms v9中模板标签使用说明. >>调用根目录下phpcms\template\content\header文件 {template "content" ...
- phpcms v9中模板标签使用及联动菜单
{template "content","header"} 调用根目录下phpcms\template\content\header文件 {charset} 字 ...
- phpcms v9实现调用多个栏目id的方法
{pc:content action="position" posid="14" catid="13,14,15,16,17,18,19,20,21& ...
- phpcms v9中调用多栏目的方法--get标签(备实例)
如调用栏目id为1,2,7的栏目列表: {pc:get sql="select * from v9_category where catid IN (1,2,7)"} {loop ...
- phpcms V9 常用函数 及 代码整理
常用函数 及 常用代码 总结如下 <?php //转换字符串或者数组的编码 str_charset($in_charset, $out_charset, $str_or_arr) //获取菜单 ...
- phpcms v9 模板调用代码大全
另:每个栏目会对应当前所选模型的三个模板文件: 这些模板文件所在位置:phpcms/templates/default/content/ 目录下,如果想修改模板文件,只需要到此目录下找到对应的模板文 ...
- phpcms v9中调用栏目及调用多个子栏目中的文章列表
调用一个指定栏目列表: {pc:content action="lists" catid="6" order="id DESC& ...
- phpcms v9模版调用代码大全(全面而实用)
首页调用栏目 {pc:content action="category" siteid="$siteid" num="15" order=& ...
随机推荐
- Leetcode Unique Word Abbreviation
An abbreviation of a word follows the form <first letter><number><last letter>. Be ...
- 【python】python新手必碰到的问题---encode与decode,中文乱码[转]
转自:http://blog.csdn.net/a921800467b/article/details/8579510 为什么会报错“UnicodeEncodeError:'ascii' codec ...
- js中修改标签的hidden属性
hidden属性在html5中,只要存在,就是隐藏效果,而不论值为多少 要显示元素,要删除hidden属性,而不是设置为false <script type="text/javascr ...
- Match:Censored!(AC自动机+DP+高精度)(POJ 1625)
Censored! 题目大意:给定一些字符,将这些字符组成一个固定长度的字符串,但是字符串不能包含一些禁词,问你有多少种组合方式. 这是一道好题,既然出现了“一些”禁词,那么这题肯定和AC自动机有点 ...
- 【剑指offer】题目20 顺时针打印矩阵
输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出 ...
- September 2nd 2016 Week 36th Friday
How does the world look through your eyes? 你眼里的世界是什么样子的? How does the world look through your eyes? ...
- R语言入门小练习
要求:模拟产生统计专业同学的名单(学号区分),记录数学,线代,英语三科成绩 > num <- seq(1513032001, 15130320100) #模 ...
- chaper3_exercise_Uva1585_score
#include<iostream> #include<string> using namespace std; int main(void) { , j = ; string ...
- fork与vfork的区别与联系
fork()与vfock()都是创建一个进程,那他们有什么区别呢?总结有以下三点区别: 1. fork ():子进程拷贝父进程的数据段,代码段 vfork ( ):子进程与父进程共享数据段 2. fo ...
- Xcode - 修改变量名、类名及字符串的替换操作
在做iOS开发代码优化的工作时,优化代码结构之前,我们应该先整理好工程的外貌,将文件和类的命名进行规范,在Xcode中为我们提供了方便而强大的名称修改功能. 第一步:修改类名 将鼠标点击放在类的名称上 ...