您现在的位置是:首页 > cms教程 > phpcms教程phpcms教程
phpcms常用调用和参数介绍
曼香2025-05-23phpcms教程已有人查阅
导读获取父分类下面的子分类结果可以用在sql 的in子句中调用根目录下phpcms\template\content\header文件{template "content","footer"}
获取父分类下面的子分类
调用根目录下phpcms\template\content\footer文件
{CHARSET}
字符集 (gbk或者utf-8)
地址替换为根目录下\statics\css{JS_PATH}
地址替换为根目录下\statics\js{pc:content action="position" posid="9" order="id" num="10" cache="3600"}
pc标签
posid="9"----------------------推荐位ID="9"
order="id"---------------------排序类型="id"
num="10" ----------------------数据调用数量="10"
cache="3600"-------------------缓存="3600"毫秒
{get_siteid()}
{IMG_PATH} 图片替换
action="hits" 排行,热点等
action="lists" 主要用于列表等。
catid="$catid" 当前栏目ID 指定数字,即为指定的栏目
num="" 调用文章的数量
order="id DESC" 按ID降序排列
order="id ASC" 按ID升序排列
"views DESC"
sort=""
"1" 缩略图
return=""
page="$page" 需要分页
每当列表几行的时候出现一次这个{if $num%2==0} {/if}
循环标签
文章链接------{$r[url]}
文章标题------{$r[title]}
标题截取------{str_cut($r[title],40,'...')}
缩略图---------loop是info的时候用 {thumb($r[thumb],110,0)} loop是data的时候用{thumb($v[thumb],90,0)}
分页标签------{$pages}
文章页标签标题-------{$title}
内容-------{$content}
日期-------{$inputtime}
来源-------{$copyfrom}
点击数------<span id="hits"></span> <script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
网站首页----------------{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]}
一级父栏目列表(catid=0)
将index.html的头和尾拆分出来,分别放在header.html和footer.html文件夹中,这三个文件放在,用{IMG_PATH}images,{CSS_PATH}css,{JS_PATH}js来替换原来的路径。
header.html
标题的替换代码
1
大图的替换代码
友情链接:
{loop subcat(77) $k $v}
{php $subcatid[] = $k;}
{/loop}
<?php $subcatid = implode(',', $subcatid);?>
结果可以用在sql 的in子句中
{template "content","header"}
调用根目录下phpcms\template\content\header文件{template "content","footer"}调用根目录下phpcms\template\content\footer文件
{CHARSET}
字符集 (gbk或者utf-8)
{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="9" order="id" num="10" cache="3600"}
pc标签
{pc:content 参数名="参数值"参数名="参数值"参数名="参数值"}
{loop $data $k $v}
<li><a href="{$v[url]}">{$v[title]}</a></li>
{/loop}
pc标签值action="position"--------------对话框的类型=“内容推荐位列表”posid="9"----------------------推荐位ID="9"
order="id"---------------------排序类型="id"
num="10" ----------------------数据调用数量="10"
cache="3600"-------------------缓存="3600"毫秒
{get_siteid()}
{IMG_PATH} 图片替换
action="hits" 排行,热点等
action="lists" 主要用于列表等。
catid="$catid" 当前栏目ID 指定数字,即为指定的栏目
num="" 调用文章的数量
order="id DESC" 按ID降序排列
order="id ASC" 按ID升序排列
"views DESC"
sort=""
"1" 缩略图
return=""
page="$page" 需要分页
每当列表几行的时候出现一次这个{if $num%2==0} {/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],40,'...')}
缩略图---------loop是info的时候用 {thumb($r[thumb],110,0)} loop是data的时候用{thumb($v[thumb],90,0)}
分页标签------{$pages}
文章页标签标题-------{$title}
内容-------{$content}
日期-------{$inputtime}
来源-------{$copyfrom}
点击数------<span id="hits"></span> <script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
网站首页----------------{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]}
一级父栏目列表(catid=0)
{pc:content action="category" catid="0" num="34" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
同级栏目列表
{pc:content action="category" catid="$parentid" num="12" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
组图列表
{loop $photos $r}
<li><a href="{$r[url]}"><img src="{thumb($r[url], 75, 45, 0)}" alt="{$r[alt]}" /></a></li>
{/loop}
注释:其中$photos为自定义组图字段,{$r[url]}为图片地址,{thumb($r[url], 75, 45, 0)}为图片缩略图,{$r[alt]}为图片描述将index.html的头和尾拆分出来,分别放在header.html和footer.html文件夹中,这三个文件放在,用{IMG_PATH}images,{CSS_PATH}css,{JS_PATH}js来替换原来的路径。
header.html
标题的替换代码
1
<title>{if isset($SEO['title']) && ! empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
头部导航菜单的替换代码
<div class="header-items">
{if $top_parentid==0}
<!--判断是不是首页-->
<a href="{siteurl($siteid)}">
<div class="h-item select">首页</div>
</a>
{else}
<a href="{siteurl($siteid)}">
<div class="h-item ">首页</div>
</a>
{/if}
{pc:content action="category" catid="0" num="6" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{if $catid==$r[catid] || $top_parentid==$r[catid]}
<div class="h-item2">/</div>
<a href="{$r[url]}">
<div class="h-item select">{$r[catname]}</div>
</a>
{else}
<div class="h-item2">/</div>
<a href="{$r[url]}">
<div class="h-item">{$r[catname]}</div>
</a>
{/if}
{/loop}
{/pc}
</div>
index.html页面大图的替换代码
<!--大图 开始-->
<div class="bigimg">
{pc:content action="lists" catid="9" order="id DESC" num="1"}
{loop $data $val}
<img src="{$val['thumb']}"/>
<!--thumb代表缩略图-->
<!--catid 是指栏目下的内容 我把图片放到9的位置 所以catid="9"-->
{/loop}
{/pc}
</div>
<!--大图 结束-->
点击图片进入某个标题的代码
<!--三项 开始-->
<div style="width: 100%; height: 30px;"></div>
<div class="three">
<div class="three-item">
<!--13代表的是栏目代号-->
<a href="{$CATEGORYS[13][url]}">
<img src="{IMG_PATH}images/three1.png"></a>
</div>
<div class="three-item">
<a href="{$CATEGORYS[11][url]}">
{pc:content action="lists" catid="16" order="id DESC" num="1"}
{loop $data $val}
<img src="{$val['thumb']}" style="height: 115px">
<!--thumb代表缩略图-->
<!--catid 是指栏目下的内容 我把图片放到9的位置 所以catid="9"-->
{/loop}
{/pc}
</a>
</div>
</div>
展示项替换代码
<!--展示项-->
{pc:content action="lists" catid="14" order="id DESC" num="4"}
{loop $data $val}
<div class="dt-item">
<a href="{$val[url]}">
<div class="dt-item-title">{$val[title]}</div>
</a>
<div class="dt-item-context">
{$val[description]}
</div>
</div>
{/loop}
{/pc}
展示项代码2
<!--优秀产品展示 开始-->
<div class="yxxm">
<div class="yxxm-title">优秀产品展示</div>
{pc:content action="lists" catid="10" order="id DESC" num="6" moreinfo="1"}
{loop $data $val}
<!--展示项-->
<div class="yxxm-item">
<a href="{$val[url]}">
<img src="{$val[thumb]}"></a>
<div class="yxxm-name">
项目名称:
<span>{$val[title]}</span>
</div>
<div class="yxxm-user">
客户:
<span>{$val[keywords]}</span>
</div>
<div class="yxxm-context">
功能:
<span style="width: 77%;">{$val[description]}</span>
</div>
<div class="yxxm-context">
开发人员:
<span>
{php list($copyfrom)=explode('|',$val['copyfrom'])}
{$copyfrom} <!--上面的意思是引自来源,吧|0去掉--></span></div></div></div>
{/loop}
{/pc}
以此段div为例,了解时间的添加代码,以及分页
<div class="right">
<a href="$val[url]"> <div class="list-title"> {$CAT['catname']}</div></a>
<!--列表项-->
{pc:content action="lists" catid="$catid" order="id DESC" num="10" page="$page"}
{loop $data $val}
<div class="right-item">
<a href="{$val['url']}">
<div class="item-context">{$val['title']}</div>
</a>
<div class="item-time">{date('Y-m-d H:i:s',$val[inputtime])}</div>
</div>
{/loop}
{/pc}
<!--分页-->
<div class="paging">
{$pages}
</div>
</div>
友情链接的添加友情链接:
{pc:link action="type_list" typeid="0" siteid="1" linktype="1" order="listorder DESC" num="4" return="pic_link"}
{loop $pic_link $v}
<a href="{$v['url']}">{$v['name']}</a>
{/loop}
{/pc}
关于我们可以用单页面来写。
本文标签:
很赞哦! ()
上一篇:phpcms源代码分析
下一篇:phpcms源码文件缓存实现方法
相关教程
图文教程
PHPCMS仿站的方法
PHPCMS怎么仿站?首先使用PHPStudy将PHPCMS安装到本地;然后根据目标网站首页,进行处理PHPCMS的模板文件;
PHPCMS的shtml设置方法
SSI是英文Server Side Includes的缩写,翻译成中文就是服务器端包含的意思。从技术角度上说,SSI就是在HTML文件中,可以通过注释行调用的命令或指针。SSI具有强大的功能
phpcms标题,栏目,导航等调用写法
获取父分类下面的子分类结果可以用在sql 的in子句中调用根目录下phpcms\template\content\header文件{template "content","footer"}
phpcms有控制器吗?怎么新增一个控制器?
phpcms有控制器。phpcms控制器是模块的类文件,储存在“phpcms/modules”下面,每个模块都是独立的命名方式,类名是“文件名+.php命名”格式;控制器类默认继承系统的函数库
相关源码
-
(自适应响应式)个人作品技术文章博客网站模板下载基于PbootCMS内核开发的响应式博客模板,为数字营销、技术分享类内容打造。采用前沿设计理念,兼顾内容展示与阅读体验,适配各类终端设备。通过本模板可快速构建专业级行业博客,有效传播专业知识与案例成果。查看源码 -
(PC+WAP)绿色日志美文文学说说博客网站pbootcms模板除日志博客类网站外,通过替换图文内容可快速适配:心情日记分享平台、文学创作社区、朋友圈内容聚合站、美文鉴赏网站、读书笔记平台等应用场景。查看源码 -
自适应电子科技类产品公司pbootcms网站模板基于PbootCMS内核开发,为电子科技类企业设计,适用于电子产品展示、企业官网等场景。该模板采用开源架构,用户可自由访问和修改源码,灵活适配各类行业需求,无需二次开发成本查看源码 -
(自适应)宽屏农业机械农耕设备类网站pbootcms模板免费下载为农机企业打造的现代化响应式网站模板,自动适配电脑、平板和手机,浏览体验一致,独立页面SEO设置,提升搜索引擎可见度。查看源码 -
(PC+WAP)蓝色钢材加工建筑装修施工材料网站模板下载为钢材加工企业设计的PbootCMS响应式模板,采用PC+WAP双端适配技术,数据实时同步。简洁大气的蓝色工业风格设计,突出钢材加工行业特性,其他制造业用户更换图文内容即可快速应用。查看源码 -
WordPress主题模板JustNews资讯博客类源码V5.2.2JustNews主题针对博客创作、自媒体运营及资讯发布类网站的需求而设计,提供专业的内容展示与管理方案。该主题集成前端用户中心功能,支持用户在前端界面发布和投稿文章,操作流程简洁高效。查看源码
| 分享笔记 (共有 篇笔记) |
