您现在的位置是:首页 > cms教程 > phpcms教程phpcms教程
phpcms标题,栏目,导航等调用写法
亦寒2025-05-29phpcms教程已有人查阅
导读获取父分类下面的子分类结果可以用在sql 的in子句中调用根目录下phpcms\template\content\header文件{template "content","footer"}
获取父分类下面的子分类
调用根目录下phpcms\template\content\footer文件
{CHARSET}
字符集 (gbk或者utf-8)
地址替换为根目录下\statics\css{JS_PATH}
地址替换为根目录下\statics\js
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)
--------------------------------------------------------------------------------
将index.html的头和尾拆分出来,分别放在header.html和footer.html文件夹中,这三个文件放在,用{IMG_PATH}images,{CSS_PATH}css,{JS_PATH}js来替换原来的路径。
header.html
标题的替换代码
大图的替换代码
{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
标题的替换代码
<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:contentaction="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:contentaction="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:contentaction="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:contentaction="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:contentaction="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}
本文标签:
很赞哦! ()
上一篇:PHPCMSV9开发文档
相关教程
图文教程
phpcms<= v9.15 任意文件读取漏洞分析和利用示例
phpcms v9的phpcms\modules\search\index.php存在任意文件读取漏洞问题很明显,$_GET['q']的参数没有进行校验,直接调用了file_get_contents函数文件并显示内容
phpcms评论模块出错怎么办
phpcms评论模块出错怎么办?phpcms文章引用评论模块首先需要安装评论模块:然后用
phpcms插件开发初步规范
(一)./include/global.php 中的函数可在phpcms的任何一个程序中调用,下面是各函数的原型及用法。
PHPCMS后台框架实现思路介绍
1.打开后台入口文件admin.php跳转到index.php并且m=admin定义了根目录,包含了框架的入口文件base.php,并且使用类静态方法creat_app()
相关源码
-
(自适应响应式)蓝色环保机械设备网站pbootcms模板HTML5源码下载基于PbootCMS的生态环境技术展示平台,通过内容调整可应用于新能源设备、污水处理、空气净化等环保相关领域。设备参数采用对比表格展示,技术原理支持图文混排;查看源码 -
帝国cms7.5品牌连锁店招商加盟商机网站模版源码本模板为招商加盟、创业投资、品牌连锁等商业领域设计,采用帝国CMS7.5内核构建,整体风格简洁大气,突出商业信任感与专业度,适合各类招商加盟项目展示、品牌连锁店宣传等商业应用场景。查看源码 -
(PC+WAP)铝合金门窗定制pbootcms网站模板源码为铝合金门窗、定制门窗企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5自适应架构,PC与手机端数据实时同步,覆盖全终端用户交互场景。查看源码 -
(响应式自适应)小学初中作文论文文章资讯博客pbootcms模板下载为中小学作文、教育类网站设计,特别适合展示学生作文、教学资源和写作指导等内容。采用响应式技术,确保在不同设备上都能获得良好的阅读体验。查看源码 -
自适应营销型IT网络工作室互联网建站公司pbootcms网站模板为IT网络服务商、建站企业打造的高性能营销门户,基于PbootCMS开源内核深度开发采用HTML5自适应架构,实现PC与手机端数据实时同步交互。查看源码 -
(PC+WAP)五金机械设备营销型模板下载带在线留言为机械设备制造商设计的营销型模板,集成产品参数对比系统、产品展示模块和询价管理功能。采用PbootCMS开发内核,PHP7+运行环境。手工编写语义化HTML5结构,CSS3动画优化交互体验。查看源码
| 分享笔记 (共有 篇笔记) |
