您现在的位置是:首页 > cms教程 > phpcms教程phpcms教程

phpcms频道页category.html使用方法

马仁2025-05-26 21:45:20phpcms教程已有3人查阅

导读1.当前栏目的ID:{$catid}标题样式:{title_style($v[style])}(在添加内容或编辑内容的时候,标题右边有一个选择颜色的块)。

1.当前栏目的ID:{$catid}
标题样式:{title_style($v[style])}(在添加内容或编辑内容的时候,标题右边有一个选择颜色的块)。
{str_cut(strip_tags($v[description]), 150)}其中str_tags是去掉html中的标签代码,只保留文字。
2.标题都尽量写成这样
<a href="{$v[url]}" title="{$v[title]}"target="_blank"{title_style($v[style])}>{str_cut($v[title], 60)}</a>
-----------------文字标题列表--------------------
{pc:content action="lists" catid="$catid" order="id DESC" num="3"}
<ul class="list">
{loop $data $k $v}
<li>·<a href="{$v[url]}" title="{$v[title]}" target="_blank"{title_style($v[style])}>{str_cut($v[title], 60)}</a></li>
{/loop}
</ul>
{/pc}
---------------------------图文标题列表---------------------------------
{pc:content action="position" posid="10" catid="$catid" thumb="1" order="listorder DESC" num="2"}
{loop $data $v}
<h4 class="blue"><a href="{$v[url]}" target="_blank"{title_style($v[style])}>{$v[title]}</a></h4>
<p><img src="{thumb($v[thumb],90,60)}" width="90" height="60" />{str_cut(strip_tags($v[description]), 150)}</p>
<div class="bk20 hr"><hr /></div>
{/loop}
{/pc}
3.判断
{if $n==1}class="on" style="margin:0"{/if}>:如果是第一条数据,就写入class="on" style="margin:0"。
4.{php $j=1;}可以在phpcms模板中,可以直接写入php代码,这里有助于一些特殊功能的开发。
5.获取当前站点的ID:get_siteid()。
6.超出范围截取:{str_cut($v[description],116,'..')}(如果超过了116个字节剩下的用..代替)。
7.排行:
浏览次数排行:
{pc:content action="hits" catid="$catid" num="10" order="views DESC" cache="3600"}
{loop $data $v}
<li><a href="{$v[url]}"target="_blank"{title_style($v[style])}>{$v[title]}</a></li>
{/loop}
{/pc}
action="hits" order="views DESC":表示点击量排行。
cache="3600":缓存时间3600毫秒。
本月排行:
{pc:content action="hits" catid="$catid" num="8"
order="monthviews DESC" cache="3600"}
{loop $data $v}
<li><span>{number_format($v[monthviews])}</span><a href="{$v[url]}"{title_style($v[style])}
class="title" title="{$v[title]}">{str_cut($v[title],56,'...')}</a></li>
{/loop}
{/pc}
{number_format($v[monthviews])}:点击次数
number_format:把字符串格式化成数字

本文标签:

很赞哦! (0)

暂无内容
暂无内容
暂无内容
暂无内容
留言与评论 (共有 0 条评论)
昵称:
匿名发表 登录账号
         
验证码: