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=& ...
随机推荐
- SDL播放视频
// PlayVideo.cpp : Defines the entry point for the console application. // extern "C" { #i ...
- 在Webstorm/Phpstorm中设置连接FTP,并快速进行文件比较,上传下载,同步等操作
Phpstorm除了能直接打开localhost文件之外,还可以连接FTP,除了完成正常的数据传递任务之外,还可以进行本地文件与服务端文件的异同比较,同一文件自动匹配目录上传,下载,这些功能是平常ID ...
- ASP.NET 上的 Async/Await 简介
原文链接 大多数有关 async/await 的在线资源假定您正在开发客户端应用程序,但在服务器上有 async 的位置吗?可以非常肯定地回答“有”.本文是对 ASP.NET 上异步请求的概念性概述, ...
- 7 天玩转 ASP.NET MVC — 第 3 天
目录 第 1 天 第 2 天 第 3 天 第 4 天 第 5 天 第 6 天 第 7 天 0. 前言 我们假定你在开始学习时已经阅读了前两天的学习内容.在第 2 天我们完成了关于显示 Employee ...
- 新建samba配置步骤
Linux系统默认已经安装了Samba,但是没有安装Samba服务: 1,先查看安装情况:rpm -qa|grep samba 根据系统的安装情况选择下载或者通过光驱安装所缺的rpm包. 我的安装情况 ...
- cf555b
题意:按顺序给出多个互不相交的区间(表示一些小岛),和一些可以连接区间的桥,每个桥有固定的长度.区间和桥的数量都是2*10^5. 两个相邻的小岛之间的桥的长度必须小于等于最远点距离,大于等于最近点距离 ...
- Django~Excel,PDF
# Text file #response = HttpResponse(mimetype='text/plain') #response['Content-Disposition'] = 'att ...
- Django函数——url()
The url() function is passed four arguments, two required: regex and view, and two optional: kwargs, ...
- K3中添加的一条新数据,其在数据库中的位置
最近研究将K3系统与生产管理系统结合起来,减少工作量,但如何确定其各自后台数据库的构成,其对应数据各自位于那张表内,总结了一下: 1.从百度搜索,查看表结构,然后找到目标表 另:K3数据库中单独 ...
- Effective C++ -----条款28:避免返回handles指向对象内部成分
避免返回handles(包括reference.指针.迭代器)指向对象内部.遵守这个条款可增加封装性,帮助const成员函数的行为像个const,并将发生“虚吊号码牌”(dangling handle ...