{pc:content action="category" catid="0" num="6" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li class="li1"><a href="{$r['url']}">{$r['catname']}</a></li>
{loop subcat($r['catid']) $v}
<li><a href="{$v['url']}">{$v['catname']}</a></li>
{/loop}
{/loop} 【一级栏目遍历二级栏目】
----------------------------------------------------------------------------------------------------------------
{pc:content action="category" catid="0" num="9" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li class="nLi <?php if($r['catid'] == $catid){echo 'on';}?> ">
<h3>
<?php $my1 = $r['arrchildid']; $my2 = explode(',',$my1);$my2 = count($my2);?>
{if $my2 == 1}
<a href="{$r['url']}" title="{$r['catname']}">{$r['catname']}</a>
{else}
<a title="{$r['catname']}">{$r['catname']}</a>
{/if}
<!-- <a href="{$r['url']}" title="{$r['catname']}">{$r['catname']}</a> -->
</h3>
<ul class="sub">
{loop subcat($r['catid']) $v}
{if $v['ismenu']==1}
<li>
<a href="{$v['url']}" title="{$v[catname]}">{$v[catname]}</a>
</li>
{/if}
{/loop}
</ul>
</li>
{/loop}
{/pc}
=======================================================================
头部标题、关键词、描述调用:
<title>{if isset($SEO['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title>
<meta name="keywords" content="{$SEO['keyword']}">
<meta name="description" content="{$SEO['description']}">
外部css、js、img调用:{CSS_PATH}、{JS_PATH}、{IMG_PATH}
头部调用:{template "content","header"}
底部调用:{template "content","footer"}
导航首页链接:{$siteurl($siteid)}
首页栏目a标签 链接地址调用:{$CATEGORYS[9][url]}
首页详情链接:{$r[url]}
搜索调用:
第一步
<form action="{APP_PATH}index.php" method="get" target="_blank">
<div class="search">
<input type="hidden" name="m" value="search"/>
<input type="hidden" name="c" value="index"/>
<input type="hidden" name="a" value="init"/>
<input type="hidden" name="typeid" value="1" id="typeid"/>
<input type="hidden" name="siteid" value="{$siteid}" id="siteid"/>
<input type="text" class="fl a1" onfocus="if(this.value=='输入您想要的信息'){this.value='';}" onblur="if(this.value==''){this.value='输入您想要的信息';}" value="输入您想要的信息" name="q" id="q"/>
<input type="submit" value="" class="tijiao fl a2" value=""/>
</div>
</form>
第二步
修改Search文件中的header和footer
Header中所有date需要修改
{pc:get sql="select * from v9_page where catid=25" return="data2"}
{loop $data2 $r}
第三步
替换list文件
导航下拉调用:
(方法一):
<ul>
<li><a href="{$siteurl($siteid)}">首页</a></li>
{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $n $r}
<li>
<a href="{$r[url]}">{$r[catname]}</a>
<ul>
{if $r[catid]==1 || $r[catid]==9 || $r[catid]==10 || $r[catid]==11 || $r[catid]==12}
{pc:get sql="select * from v9_category where parentid=$r[catid] order by listorder asc"}
{loop $data $n $s}
<li><a href="{$s[url]}">{$s[catname]}</a></li>
{/loop}
{/pc}
{/if}
</ul>
</li>
{/loop}
{/pc}
</ul>
(方法二):
<ul id=nav>
<li class="dangqian" ><a href="{$siteurl($siteid)}">网站首页</a></li>
{pc:content action="category" catid="0" siteid="$siteid" order="listorder asc" num="6"}
{loop $data $n $r}
<li><a href="{$r[url]}">{$r[catname]}</a>
{if $r[catid]==9 || $r[catid]==11 || $r[catid]==12 || $r[catid]==13}
<ul>
{pc:content action="category" catid="$r[catid]" siteid="$siteid" order="listorder asc"}
{loop $data $n $s}
<li><a href="{$s[url]}">{$s[catname]}</a></li>
{/loop}
{/pc}
</ul>
{else}
{if $r[catid]==10}
<ul>
{pc:content action="category" catid="$r[catid]" siteid="$siteid" order="listorder asc"}
{loop $data $n $s}
<li><a href="{$s[url]}">{$s[catname]}</a></li>
<li><a href="">携手金德</a></li>
<li><a href="">直播间</a></li>
{/loop}
{/pc}
</ul>
{/if}
{/if}
</li>
{/loop}
{/pc}
<div class="clearfix"></div>
</ul>
banner调用:
(一)
<ul id="slides">
{pc:content action="lists" catid="15" moreinfo="1" thumb="" num="10" order="listorder desc"}
{loop $data $n $r}
<li style="background:url('{$r[tusrc]}') no-repeat center top">
<a href="{$siteurl($siteid)}" target="_blank"></a></li>
{/loop}
{/pc}
</ul>
(二)第一张图和其余两张图样式不一样
{pc:content action="lists" catid="20" num="3" order="listorder desc" moreinfo="1"}
{loop $data $r}
<div {if $n==1}class="item active"{else}class="item"{/if}>
<img src="{$r[thumb]}" alt="First slide">
</div>
{/loop}
{/pc}
从第2条开始调用:
{pc:content action="lists" catid="6" order="id DESC LIMIT 1,8--" thumb="" moreinfo="1" }
{loop $data $n $r}
<li><span style="float:right">[{date('Y-m-d',"$r[inputtime]")}]</span><a href="{$r[url]}" title="{$r[title]}">{$r[title]}</a></li>
{/loop}
{/pc}
首页缩略图调用,如果没有缩略图其它图片代替:
<img src="{if $r[thumb]}{$r[thumb]}{else}{IMG_PATH}nopic.gif{/if}" width="161" height="107">
缩略图:<img src="{$r[thumb]}" width="225" height="161"/>
产品栏目名称调用:
{loop subcat(9,0,0,$siteid) $r}
<a href="{$r[url]}">{$r[catname]}</a>
{/loop}
文字友情链接:
{pc:link action="type_list" siteid="1" linktype="0" order="listorder DESC" num="8" }
{loop $data $n $r}
<a href="{$r[url]}" target="_blank">{$r[name]}</a>|
{/loop}
{/pc}
图片友情链接:
{pc:link action="type_list" siteid="$siteid" linktype="1" order="listorder DESC" num="8" return="pic_link"}
{loop $pic_link $v}
<li><a href="{$v['url']}" title="{$v['name']}" target="_blank"><img src="{$v[logo]}" width="88" height="31" /></a></li> {/loop}
{/pc}
栏目描述调用:{$CATEGORYS[$catid][description]}
栏目名称调用:{$CATEGORYS[$catid][catname]} 栏目父级名称调用:{$CATEGORYS[$parentid][catname]}
栏目图片调用:{$CAT[image]}或{$CATEGORYS[$CAT[parentid]][image]}或{$CATEGORYS[$catid][image]}
面包屑:<a href="{siteurl($siteid)}">首页</a> > {catpos($catid)}
{catpos($catid)} 显示文章位置导航
{$CATEGORYS[$catid][url]} 显示当前栏目链接
单页面内容调用:
{pc:get sql="select * from v9_page where catid=$catid"}
{loop $data $n $r}
{$r[content]}或{str_cut(strip_tags($r['content']),"300","…")}或{str_cut(strip_tags($r['content']),"300"," ")}
{/loop}
{/pc}
栏目子栏目名称调用:(方法一)
{pc:get sql="select * from v9_category where parentid=21"}
{loop $data $n $s}
<li><a href="{$s[url]}">{$s[catname]}<span class="pull-right">></span></a></li>
{/loop}
{/pc}
(方法二)
{pc:content action="category" catid="10" num="5" siteid="$siteid" order="id ASC"}
{loop $data $r}
<li><div class="data-link"><a href="{$r[url]}" >{$r[catname]}</a></div></li>
{/loop}
{/pc}
(方法三)
{pc:get sql="select * from v9_category where catid in(76)" return="data"}
{loop $data $r}
<div>
<a href="index.php?m=wap&a=page&catid=76"><img src="{thumb($r[image],220,200,1)}" /></a>
</div>
<div class="hkfwcontent">
<a class="nr" href="index.php?m=wap&a=page&catid=76">
<span>{$r[catname]}</span>
<p id="wrap">{$r['description']}</p>
</a>
</div>
{/loop}
{/pc}
(方法四)
<div class="left_nr">
<div class="cpfw">
<img src="{IMG_PATH}nav_bj01.jpg" />
<p>{$CATEGORYS[$CAT[parentid]][catname]}</p>
<p class="yingyu">{$CATEGORYS[$CAT[parentid]][description]}</p>
</div>
<ul class="sub_nav">
{pc:content action="category" catid="$parentid" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<a href="{$r[url]}"><li>{$r[catname]}</li></a>
<div style="height:1px; 230px; </div>
{/loop}
{/pc}
</ul>
</div>
公用频道页调用子栏目:
<div class="leftnav">
<ul>
{pc:content action="category" catid="$catid" siteid="$siteid" order="listorder asc"}
{loop $data $k $r}
<li {if $n==1} class="dangqianye"{/if}><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
公用列表页调用子栏目:
<div class="leftnav">
<ul>
{pc:content action="category" catid="$parentid" siteid="$siteid" order="listorder asc"}
{loop $data $n $r}
<li {if $catid==$r[catid]} class="dangqianye"{/if}><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
===========================================================================================
===========================================================================================
列表页标题内容调用:
{pc:content action="lists" catid="$catid" num="16" order="id DESC"或order="listorder desc" moreinfo="1" page="$page"}
<ul class="u1">
{loop $data $r}
<li><span>{date('Y-m-d',$r[inputtime])}</span><a href="{$r[url]}" target="_blank" {title_style($r[style])}>{$r[title]}</a> <a href="{$r['url']}"><img src="{$r[thumb]}" width="155" height="115" class="fl"/></a></li>
<p>{str_cut(strip_tags($r['content']),"250","…")}</p>
{/loop}
</ul>
<div id="pages" class="text-c">{$pages}</div>
{/pc}
文章标题:{$title} 文章内容:{$content} 摘要{$r['description']} 关键字:{$keywords}
时间:{$inputtime} 来源:{$copyfrom} 评论:<a href="#comment_iframe" id="comment">0</a> 点击:<script type="text/javascript" src="{JS_PATH}jquery.min.js"></script>
<b id="hits" style="font-weight:normal;></b>
<script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
上下篇:
<strong>上一篇:</strong><a href="{$previous_page[url]}">{$previous_page[title]}</a><br />
<strong>下一篇:</strong><a href="{$next_page[url]}">{$next_page[title]}</a>
相关文章调用:
{pc:content action="relation" relation="$relation" id="$id" catid="$catid" num="5" keywords="$rs[keywords]"}
{loop $data $r}
<li><a href="{$r[url]}" target="_blank">{str_cut($r[title],32,'')}<i>({date('Y-m-d',$r[inputtime])})</i></a></li>
{/loop}
{/pc}
列表页内容随机调用:
{pc:content action="lists" catid="$catid" num="8" order="rand()" return="info"}
<ul class="list lh24 f13">
{loop $info $v}
<li><a href="{$v['url']}" target="_blank" title="{$v['title']}"{title_style($v[style])}>{$v['title']}</a></li>
{/loop}
</ul>
{/pc}
加入浏览器收藏:
(一)
<a href="javascript:;" onclick="AddFavorite();">加入收藏</a>
<script language="javascript">
//加入收藏夹,兼容多种浏览器
function AddFavorite(sURL, sTitle)
{
try{window.external.addFavorite(sURL, sTitle);}
catch (e)
{
try{window.sidebar.addPanel(sTitle, sURL, "");}
catch (e){alert("加入收藏失败,请使用Ctrl+D进行添加");}
}
}
//设置为首页
function SetHome(obj,vrl){
try{obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);}
catch(e){
if(window.netscape) {
try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}
catch (e) {alert("此操作被浏览器拒绝! 请在浏览器地址栏输入“about:config”并回车 然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',vrl);
}
}
}
</script>
(二)
<ahref="http://hbwlpv.com/"onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('{siteurl($siteid)}');">设为首页</a>|
<a href="http://hbwlpv.com/" onclick="javascript:window.external.AddFavorite('http://hbwlpv.com/','安徽卧龙泵阀公司')">加入收藏</a>
phpcmsv9首页头条推荐:
(一)
{pc:content action="position" posid="2" order="listorder DESC" num="1"}
{loop $data $r}
<img src=" src="{$r[thumb]}" title="{$r[title]}" src="{$r[title]}">
<div class="headlinetop"> <a href="{$r[url]}" target="_blank">
<h3>{str_cut($r[title],20,'')}</h3>
<p>{str_cut($r[description],102)}</p>
</a> </div>
{/loop}
{/pc}
(二)
{pc:content action="position" posid="2" catid="33" order="listorder ASC" num="3"}
{loop $data $r}
<li>
<a href="{$CATEGORYS[$r[catid]][url]}" class="fwlist_a22">{$CATEGORYS[$r[catid]][catname]} </a>
<p class="fwlist_p2">{$r[title]}</p>
<img src="{$r[thumb]}" width="284" height="156"/></a>
</li>
{/loop}
{/pc}
<!--单个调用关键字列表-->
<span>此文关键字:</span>
{loop $keywords $keyword}
<li><a href="{APP_PATH}index.php?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}" class="blue">{$keyword}</a></li>
{/loop}
调用子级栏目内容:
(方法一)
{php $j=1;}
{loop subcat($catid) $v}
{php if($v['type']!=0) continue;}
{pc:content action="lists" catid="$v[catid]" order="inputtime DESC"}
{loop $data $v}
<img src="{$v[thumb]}" width="155" height="115" class="fl"/>
{/loop}
{/pc}
{$j++}
{/loop}
(方法二)
{pc:content action="category" catid="26" siteid="$siteid" order="id ASC"}
{loop $data $r}
<dl class="am-accordion-item ">
<dt class="am-accordion-title servce_dt" >
{$r[catname]}<i class="icon_acd"></i>
</dt>
<dd class="am-accordion-bd am-collapse servce_dd1">
{pc:content action="lists" catid="$r[catid]" order="listorder asc" moreinfo="1"}
{loop $data $v}
<div class="am-accordion-content">
<h5 class="ac_con_q0"><i class="icon_acd"></i>{$v[title]}</h5>
<div class="ac_con_answer ac_con_a0">{$v[content]}</div>
</div>
{/loop}
{/pc}
</dd>
</dl>
{/loop}
{/pc}
调用留言内容:
{pc:get sql="select * from v9_form_fankui" num="4" page="$page"}
{loop $data $n $r}
<table width="700" border="0" cellpadding="0" cellspacing="0" class="bkk">
<tbody>
<tr>
<td width="499" height="25" background="{IMG_PATH}bgly.jpg" class="wenzi12"> 姓名:<font color="#3399FF"><b>{$r[name]}</b></font></td>
<td width="247" background="{IMG_PATH}bgly.jpg" class="wenzi12"><span class="wz1">发表时间:{date("Y-m-d","$r[datetime]")}</span></td>
</tr>
<tr>
<td height="41" colspan="2" background="{IMG_PATH}xian.JPG" class="wz13"> {$r[content]} </td>
</tr>
<tr>
<td height="25" colspan="2" background="{IMG_PATH}xian.JPG" class="hf">回复内容:{$r[answer]} <br></td>
</tr>
</tbody>
</table>
<br>
{/loop}
{/pc}
标题选中状态:
1、指定id:
<div class="vidnav">
<ul>
<li><a href="{$CATEGORYS[13]['url']}" {if $catid==13 }class="a_hover"{/if}>全部</a></li>
{pc:content action="category" catid="13" num="25" order="listorder ASC"}
{loop $data $r}
<li><a {if $catid==$r[catid]}class="a_hover"{/if} href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
2、一级栏目:
头部(频道页、列表页、详情页共同):
<div class="mainnav">
<ul id=nav>
<li {if !$catid} class="dangqian"{/if}><a href="{$siteurl($siteid)}">网站首页</a></li>
{pc:content action="category" catid="0" siteid="$siteid" order="listorder asc" num="6"}
{loop $data $n $r}
{if $catid == $r[catid] || $parentid == $r[catid] || $top_parentid == $r[catid]} class="on"{/if}>
<li {if $catid==$r[catid]||$parentid==$r[catid]||$top_parentid==$r[catid]} class="dangqian"{/if}>
<a href="{$r[url]}">{$r[catname]}</a>
</li>
{/loop}
{/pc}
<div class="clearfix"></div>
</ul>
</div>
左侧导航:
<div class="leftnav">
<ul>
{pc:content action="category" catid="7 " siteid="$siteid" order="listorder asc"}
{loop $data $n $r}
<li {if $catid==$r[catid]||$parentid==$r[catid]||$CAT[parentid]==$r[catid]}class="dangqian"{/if}>
<ahref="{$r[url]}">{$r[catname]}</a>
</li>
{/loop}
{/pc}
</ul>
</div>
3、频道页选中一级栏目和相应的第一个二级栏目:
头部一级栏目代码:
<ul id=nav>
<li {if !$catid} class="dangqian"{/if}><a href="{$siteurl($siteid)}">网站首页</a></li>
{pc:content action="category" catid="0" siteid="$siteid" order="listorder asc" num="6"}
{loop $data $n $r}
<li {if $catid==$r[catid]} class="dangqian"{/if}><a href="{$r[url]}">{$r[catname]}</a>
</li>
{/loop}
{/pc}
<div class="clearfix"></div>
</ul>
左侧子栏目代码:
<div class="leftnav">
<ul>
{pc:content action="category" catid="$catid" siteid="$siteid" order="listorder asc"}
{loop $data $k $r}
<li {if $n==1} class="dangqianye"{/if}><a href="{$r[url]}"> {$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
4、列表页选中当前子栏目和相应的一级栏目:
头部一级栏目代码:
<ul id=nav>
<li {if !$catid} class="dangqian"{/if}><a href="{$siteurl($siteid)}">网站首页</a></li>
{pc:content action="category" catid="0" siteid="$siteid" order="listorder asc" num="6"}
{loop $data $n $r}
<li {if $r[catid]==$parentid} class="dangqian"{/if}><a href="{$r[url]}">{$r[catname]}</a>
</li>
{/loop}
{/pc}
<div class="clearfix"></div>
</ul>
左侧子栏目代码:
<div class="leftnav">
<ul>
{pc:content action="category" catid="$parentid" siteid="$siteid" order="listorder asc"}
{loop $data $n $r}
<li {if $parentid ==$r[catid]} class="dangqianye"{/if}><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
5、详情页选中当前子栏目和相应的一级栏目:
头部一级栏目代码:
<ul id=nav>
<li {if !$catid} class="dangqian"{/if}><a href="{$siteurl($siteid)}">网站首页</a></li>
{pc:content action="category" catid="0" siteid="$siteid" order="listorder asc" num="6"}
{loop $data $n $r}
<li {if $catid==$r[catid] || $top_parentid==$r[catid]} class="dangqian"{/if}>
<a href="{$r[url]}">{$r[catname]}</a>
</li>
{/loop}
{/pc}
<div class="clearfix"></div>
</ul>
左侧子栏目代码:
<div class="leftnav">
<ul>
{pc:content action="category" catid="$top_parentid" siteid="$siteid" order="listorder asc"}
{loop $data $n $r}
<li {if $catid==$r[catid]} class="dangqianye"{/if}><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
</ul>
</div>
6、如果头部栏目不是调用,则选中状态需要写固定的id号:
<div class="mainnav">
<div class="content">
<ul>
<li {if !$catid} class="dangqian"{/if}><a href="{$siteurl($siteid)}"><img src="{IMG_PATH}shouye.png" /></a></li>
<li {if $catid==9}class="dangqian"{/if}><a href="{$CATEGORYS[9][url]}"><img src="{IMG_PATH}gybz.png" /></a></li>
<li {if $catid==10}class="dangqian"{/if}><a href="{$CATEGORYS[10][url]}"><img src="{IMG_PATH}zzjs.png" /></a></li>
<li {if $catid==11}class="dangqian"{/if}><a href="{$CATEGORYS[11][url]}"><img src="{IMG_PATH}czal.png" /></a></li>
<li {if $catid==12}class="dangqian"{/if}><a href="{$CATEGORYS[12][url]}"><img src="{IMG_PATH}ycwz.png" /></a></li>
<li {if $catid==13}class="dangqian"{/if}><a href="{$CATEGORYS[13][url]}"><img src="{IMG_PATH}qqfl.png" /></a></li>
<li {if $catid==14}class="dangqian"{/if}><a href="{$CATEGORYS[14][url]}"><img src="{IMG_PATH}tszs.png" /></a></li>
<li {if $catid==15}class="dangqian"{/if}><a href="{$CATEGORYS[15][url]}"><img src="{IMG_PATH}qqpx.png" /></a></li>
<li {if $catid==16}class="dangqian"{/if}><a href="{$CATEGORYS[16][url]}"><img src="{IMG_PATH}flyz.png" /></a></li>
<li {if $catid==17}class="dangqian"{/if}><a href="{$CATEGORYS[17][url]}"><img src="{IMG_PATH}bztj.png" /></a></li>
<li {if $catid==18}class="dangqian"{/if}><a href="{$CATEGORYS[18][url]}"><img src="{IMG_PATH}zxly.png" /></a></li>
<li {if $catid==19}class="dangqian"{/if}><a href="{$CATEGORYS[19][url]}"><img src="{IMG_PATH}lxwm.png" /></a></li>
</ul>
</div>
</div>
调用服务器时间(当前时间)的新闻:
{pc:content action="lists" catid="37" order="listorder desc" moreinfo="1"}
{loop $data $r}
<!-- <?php echo date('Y-m-d',$r[inputtime])?>
<?php echo date('Y-m-d',time())?> -->
{php $now=date('Y-m-d',time());}
{if date('Y-m-d',time())==date('Y-m-d',$r[inputtime])}
<tr>
<th>{$r[shijian]}</th>
<th>{$r[title]}</th>
<th>{$r[zhibiaomingcheng]}</th>
<th>{$r[qianzhi]}</th>
<th>{$r[yucezhi]}</th>
<th>{$r[gongbuzhi]}</th>
<th>{date('Y-m-d',$r[inputtime])}</th>
</tr>
{else}
<tr>
<th>今天暂无公告!</th>
<th></th>
<th></th>
</tr>
{/if}
{/loop}
{/pc}
邮箱的连接:<a href="mailto:boss@mail.com" >联系我们</a>
QQ的链接:
<a href="http://wpa.qq.com/msgrd?v=3&uin=946780264&site=www.cactussoft.cn&menu=yes" target="_blank" title="点击这里给我发消息" >客服</a>
列表页左侧子栏目链接不同:
{pc:content action="category" catid="$catid" siteid="$siteid" order="listorder asc"}
{loop $data $n $r}
{if $r[catid]==29}
<a href="{$CATEGORYS[33][url]}" target="_self" class="productclass_dolphin">{$r[catname]}</a>
{elseif $r[catid]==30}
<a href="{$CATEGORYS[32][url]}" target="_self" class="productclass_dolphin">{$r[catname]}</a>
{else}
<a href="{$r[url]}" target="_self" class="productclass_dolphin">{$r[catname]}</a>
{/if}
{/loop}
{/pc}
频道页内容部分默认选中第一个子栏目的内容:
(单页面)
{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
{if $n==1}
{pc:get sql="SELECT * FROM jk_page where catid=$r[catid]"}
{loop $data $key $val}
{$val[content]}
{/loop}
{/pc}
{/if}
{/loop}
{/pc}
多图字段图片和名称的调用:
一、列表页调用:
方法一(自定义):
{pc:content action="lists" catid="$catid" order="listorder DESC" moreinfo="1"}
{loop $daibiaozuo $pic_k $r}
<li>
<img src="{$r[url]}" width="357" height="202">
<div class="xgt">
<span>{$r[alt]}</span>
</div>
</li>
{/loop}
{/pc}
方法二(组图字段):
{pc:content action="lists" catid="23" moreinfo="1" order="listorder desc"}
{loop $data $n $r}
<h3>{$r[title]}</h3>
<p>{$r[content]}</p>
<div class="clear"></div>
<div class="fourimg">
<ul>
{loop string2array($r['pictureurls']) $pic_k $v}
<li><img src="{thumb($v[url],381,246)}"></li>
{/loop}
</ul>
<div class="clear"></div>
</div>
<div class="clear"></div>
{/loop}
{/pc}
二、任意页面调用自定义字段多图:
{pc:content action="lists" catid="$catid" num="1" order="id ASC" moreinfo="1" }
{loop $data $v}
<h1>{$v[title]}</h1>
<ul class="topList-con">
{loop string2array($v['pictureurls']) $pic_k $r}
<li>
<div class="item">
<div class="imgBox"><img src="{thumb($r[url],350,200)}" width="350" height="200" alt="{$r[alt]}"/></div>
<div class="img_title">{$r[alt]}</div>
</div>
</li>
{/loop}
</ul>
{/loop}
{/pc}
加到会员个人中心的收藏:
<span id='favorite'>
<a href="javascript:;" onclick="add_favorite('{addslashes($title)}');" class="t6">收藏</a>
</span>
<script language="javascript">
//加入收藏夹,兼容多种浏览器
function add_favorite(title) {
$.getJSON('{APP_PATH}api.php?op=add_favorite&title='+encodeURIComponent(title)+'&url='+encodeURIComponent(location.href)+'&'+Math.random()+'&callback=?', function(data){
if(data.status==1) {
// $("#favorite").html('收藏成功');
alert('收藏成功!请到个人中心查看');
} else {
alert('请登录');
}
});
}
</script>
新闻类频道页调用子分类名称和对应分类下的内容:
<div class="tabox">
<div class="hd">
<ul>
{pc:content action="category" catid="$catid" num="2" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li>{$r[catname]}</li>
{/loop}
{/pc}
</ul>
</div>
<div class="bd">
{pc:content action="catgory" catid="$catid" order="listorder desc" moreinfo="1"}
{loop $data $n $r}
<ul class="lh" style="display: none;">
{pc:content action="lists" catid="$r[catid]" order="listorder desc" moreinfo="1" num="10" page="$page"}
<li>
{loop $data $n $s}
<div class="one">
<span><a href="{$s[url]}">{$s[title]}</a></span>
<p><a href="{$s[url]}" >{str_cut(strip_tags($s[content]),"200")}<font style="color:#FF6600"><更多></font></a></p>
</div>
{/loop}
</li>
<div class="page_con">{$pages}</div>
{/pc}
</ul>
{/loop}
{/pc}
</div>
</div>
同一个模板根据不同catid显示不同的表单:
{if $catid==12}
<form method="post" action="index.php?m=formguide&c=index&a=show&formid=15&siteid=1" name="myform" id="myform">
<p>姓名:<input type="text" value="" name="info[name]" id="name"></p>
<p>电话:<input type="text" value="" name="info[phone]" id="phone"></p>
<p id="jl">写下您的工作经历吧:<textarea name='info[content]' id='content'></textarea></p>
<input id="qdtj" type="submit" value="确定提交" name="dosubmit" id="dosubmit">
</form>
{else}
<form method="post" action="index.php?m=formguide&c=index&a=show&formid=16&siteid=1" name="myform" id="myform">
<p>姓名:<input type="text" value="" name="info[name]" id="name"></p>
<p>电话:<input type="text" value="" name="info[phone]" id="phone"></p>
<p id="ly">请写下您的留言吧:<textarea></textarea></p>
<input id="qdtj" type="submit" value="确定提交" name="dosubmit" id="dosubmit">
</form>
{/if}
频道页一级栏目自动跳转到其下的第一个子栏目:
<?PHP
if($child){
$child_arrary=explode(',',$arrchildid);
$to_url=$CATEGORYS[$child_arrary[0]][url];
echo "<script>window.location.href='".$to_url."'</script>";
}
?>
phpcms v9 调用当前栏目标签代码汇总
当前栏目id: {$catid}
当前栏目名: {$CATEGORYS[$catid][catname]}
当前栏目目录名: {$CATEGORYS[$catid][catdir]}
当前栏目url: {$CATEGORYS[$catid][url]}
当前栏目位置(面包屑导航): 首页 > {catpos($catid)} 正文
当前栏目描述: {$CATEGORYS[$catid][description]}
当前栏目图片:
当前栏目的内容数: {$CATEGORYS[$catid][items]}
当前栏目的点击数: {$CATEGORYS[$catid][hits]}
当前栏目的上级栏目id: {$CATEGORYS[$catid][parentid]}
新闻列表页前两条显示“靠谱”两字:
{pc:content action="lists" catid="$catid" num="4" order="listorder desc" moreinfo="1" page="$page" return="info"}
{php $j='靠谱';}
<ul class="nlwrap">
{loop $info $r}
{php $num++}
{if $num<=2}
<li><span style="color:blue;">{php echo $j}</span>
<a href="{$r[url]}">{$r[title]}</a>
<span>{date('Y-m-d',$r[inputtime])}</span>
<p>{str_cut(strip_tags($r[content]),"400")}</p>
<a href="{$r[url]}">查看详情>></a>
</li>
{else}
<li>
<a href="{$r[url]}">{$r[title]}</a>
<span>{date('Y-m-d',$r[inputtime])}</span>
<p>{str_cut(strip_tags($r[content]),"400")}</p>
<a href="{$r[url]}">查看详情>></a>
</li>
{/if}
{/loop}
</ul>
<div class="seppage">
{$pages}
</div>
{/pc}
产品分类页间隔行样式相同并且每类小图标不同(小图标命名从1开始,例如1.png):
{pc:content action="category" catid="$catid" order="listorder asc" moreinfo="1"}
{loop $data $r}
{if $n%2!==0}
<div class="cpzx_c1">
<div class="cpl"><img src="{$r[image]}"></div>
<div class="cpr">
<ul>
<li><img src="{IMG_PATH}{$n}.png"> <span>{$r[catname]}</span></li>
<li><p>{$r[description]}</p></li>
<li><a href="{$r[url]}"><input type="button" value="查看更多"></a></li>
</ul>
</div>
</div>
{else}
<div class="cpzx_c2">
<div class="cp2l">
<ul>
<li><img src="{IMG_PATH}{$n}.png"> <span>{$r[catname]}</span></li>
<li><p>{$r[description]}</p></li>
<li><a href="{$r[url]}"><input type="button" value="查看更多"></a></li>
</ul>
</div>
<div class="cp2r"><img src="{$r[image]}"></div>
</div>
{/if}
{/loop}
{/pc}
轮播图id号从零自增,第一张图显示其余隐藏:
{pc:content action="lists" catid="15" order="listorder desc" moreinfo="1"}
{php $j=-1}
{loop $data $r}
{php $j++}
{if $j==0}
<a target="_blank" href="{$r[url]}"><img src="{$r[thumb]}" border="0" class="photorollx3_dolphinpic" id="photorollx3_dolphinpic_{$j}" style="display: inline; 199px; height:134px; "></a>
{else}
<a target="_blank" href="{$r[url]}"><img src="{$r[thumb]}" border="0" class="photorollx3_dolphinpic" id="photorollx3_dolphinpic_{$j}" style="display: none; 199px; height:134px; "></a>
{/if}
{/loop}
{/pc}
实现首页、列表页调用浏览量:
1、Phpcms v9首页调用点击量
{pc:content action="lists" catid="$r[catid]" num="5" order="id DESC" return="info"}
{php $categorys = getcache('category_content_'.$siteid,'commons');}
<ul class="list lh24 f14">
{loop $info $v}
{php $category = $categorys[$v[catid]];}
{php $modelid = $category['modelid'];}
{php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$v[id])); $views = $_r[views]; }
{php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$v[catid].'-'.$v[id].'-'.$modelid));}
<li>·<a href="{$v['url']}" target="_blank" title="{$v['title']}"{title_style($v[style])}>{str_cut($v['title'],40)}</a> 点击:{$views} 评论:{if $comment_total}{$comment_total}{else}0{/if}</li>
{/loop}
</ul>
{/pc}
2、Phpcms v9列表页调取点击量
{php $db = pc_base::load_model(‘hits_model’); $_r = $db->get_one(array(‘hitsid’=>’c-’.$modelid.’-’.$r[id])); $views = $_r[views]; }
点击:{$views}
网站头部显示当前时间:
<div style="color:#ce8e8e">
欢迎光临,现在是
<label id="nnowdate"></label>
<script>
setInterval("document.getElementById('nnowdate').innerHTML=new Date().toLocaleString().substring(0,10) + ' ' + new Date().toLocaleTimeString();",1000);
</script>
</div>
列表页调用产品浏览量和没有产品浏览过其他的内容:
<div class="aboutrig right">
<p class="titl"><a href="/"> 首页</a> >{catpos($catid)}</p>
<div class="clearfix nelistya">
<ul class="clearfix">
{pc:content action="lists" catid="$catid" order="listorder DESC" page="$page" num="15"}
{loop $data $r}
{php $h_md=pc_base::load_model('hits_model');$get_db=$h_md->get_one(array('hitsid'=>"c-".$modelid."-".$r[id]));$views=$get_db[views];}
<li class="clearfix"><b class="okb2"></b><a href="{$r[url]}" class="left" >{$r[title]}</a><span class="right">[{date("Y-m-d",$r[inputtime])}](点击<strong>{$views}</strong>)</span></li>
{/loop}
</ul>
<div class=" clear pagee">
<p>{$pages}</p>
</div>{/pc}
</div>
<div class="xiangguan">
<span style="margin-left: 18px;">浏览过本站的还浏览了</span>
{php $aa=array(18,20,41,44,19,17,43,42,45,21,22,46);}
{php $bb= rand(0,11);}
{php $cc= $aa[$bb];}
{pc:content action="lists" catid="$cc" moreinfo="1" thumb="" num="4" return="info"}
<ul>
{loop $info $v}
<li><a href="{$v[url]}" title="{$v[title]}"><img src="{$v[thumb]}" width="150" height="110" alt="{$v[title]}" /></a><div><a href="{$v[url]}">{str_cut("$v[title]","34","…")}</a></div></li>
{/loop}
</ul>
{/pc}
</div>
</div>
站长统计
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1264511182'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/stat.php%3Fid%3D1264511182%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script>
排序
listorder DESC,inputtime desc,id DESC
111111111111111111111111111111
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=897089630&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:897089630:52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
标题
<h3>{$CATEGORYS[103][catname]}</h3>
<p style="margin-bottom:40px;">{$CATEGORYS[103][ description ]}</p>
时间
{date('Y',$r[inputtime])}
内容页时间
{$inputtime}
{date('Y-m-d',$rs[inputtime])}
<img src="{$CATEGORYS[$top_parentid][image]}" alt="{$CATEGORYS[$top_parentid][catname]}" title="{$CATEGORYS[$top_parentid][catname]}">
站点名称:
首先在模板需要调用站点名的地方先加上这个设置全局变量
{php $SITE = getcache('sitelist','commons');}
然后在需要显示站点名的地方用这个标签就可以
{$SITE[$siteid][name]}
分享网址
http://www.bshare.cn/help/installAction
去处标签strip_tags 控制字段长度str_cut
{str_cut(strip_tags($r['content']),"300","...")}
英文目录
<p>{$CATEGORYS[8][catdir]}</p>
内容页点击量
点击:</span><span id="hits"></span></h1>
<script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
{pc:content action="lists" catid="$catid" num="3" order="id DESC" moreinfo="1" page="$page"}
{loop $data $r}
{var_dump($r['content'])}
{/loop}
{/pc}
disabled="disabled"
D:WWWhnzkphpcmslibsfunctionsglobal.func.php