获取父分类下面的子分类
{loop subcat(77) $k $v}
{php $subcatid[] = $k;}
{/loop}
<?php $subcatid = implode(',', $subcatid);?> 结果可以用在sql 的in子句中
{template "content","header"}
调用根目录下phpcms emplatecontentheader文件
{template "content","footer"}
调用根目录下phpcms emplatecontentfooter文件
{CHARSET}
字符集 (gbk或者utf-8)
{if isset($SEO['title']) && !empty($SEO['title'])}
{$SEO['title']}{/if}
{$SEO['site_title']}
{$SEO['keyword']}
{$SEO['description']}
标题和标题seo优化
{CSS_PATH}
地址替换为根目录下staticscss
{JS_PATH}
地址替换为根目录下staticsjs
{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> |
头部导航菜单的替换代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<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页面
大图的替换代码
|
1
2
3
4
5
6
7
8
9
10
11
|
<!--大图 开始--> <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> <!--大图 结束--> |
点击图片进入某个标题的代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!--三项 开始--> <div style=" 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> |
展示项替换代码
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!--展示项--> {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
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<!--优秀产品展示 开始--> <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=" 77%;">{$val[description]}</span> </div> <div class="yxxm-context"> 开发人员: <span> {php list($copyfrom)=explode('|',$val['copyfrom'])} {$copyfrom} <!--上面的意思是引自来源,吧|0去掉--></span></div></div></div> |
|
1
|
|
|
1
2
3
4
5
6
|
{/loop}{/pc} |
以此段div为例,了解时间的添加代码,以及分页
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<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> |
友情链接的添加
|
1
2
3
4
5
6
7
8
|
友情链接: {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} |
关于我们可以用单页面来写,
