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=& ...
随机推荐
- When building php 5.3, if you get the following error:
buildconf: You need autoconf 2.59 or lower to build this version of PHP. You are currently trying to ...
- 一个Try多个Catch需要注意的事项
一个程序包含一个try块和两个catch块,两个catch子句都有能力捕捉一个try块发出的异常,若两个catch子句次序不同时程序结果会发生变化吗? 一个try块后有两个catch块,这很正常,因为 ...
- Unity3D研究院之拓展系统自带组件的Inspector视图
转自 http://www.xuanyusong.com/archives/3455 using UnityEngine; using System.Collections; using UnityE ...
- 9.SpringMVC和json结合传递数据 && 10.SpringMVC获取controller中json的数据
- Django~Views
In Django, web pages and other content are delivered by views. To get from a URL to a view, Django u ...
- JavaScript高级程序设计学习笔记--函数表达式
关于函数声明,它的一个重要特征就是函数声明提升,意思是在执行代码之间会读取函数声明,意思是在执行代码之前会先读取函数声明.这就意味着可以把函数声明放在调用它的语句 后面. sayHi(); funct ...
- 【leetcode】Largest Number ★
Given a list of non negative integers, arrange them such that they form the largest number. For exam ...
- codeforces gym 100286 I iSharp (字符串模拟)
题目链接 给定一个字符串.输入是int& a*[]&, b, c*; 输出是 int&&[]* a;int& b;int&* c; 输入格式里逗号后面一 ...
- Target runtime Apache Tomcat v6.0 is not defined.错误解决方法
一.背景 最近在使用本地的tomcat进行运行项目的时候,发现出现了如题所述的问题.不知道什么原因,经过努力解决了该问题. 二.解决步骤 右击项目---选择属性---选择targeted runtim ...
- 25个增强iOS应用程序性能的提示和技巧(中级篇)(3)
25个增强iOS应用程序性能的提示和技巧(中级篇)(3) 2013-04-16 14:42 破船之家 beyondvincent 字号:T | T 本文收集了25个关于可以提升程序性能的提示和技巧,分 ...