调用二级栏目 {pc:content action="category"catid="0" num="25" siteid="$siteid"order="listorder ASC"} <a href="{siteurl($siteid)}">首页</a> {loop $data $r}<!-- 一级栏目循环开始 --> <a href="{$r[url]}">{$r[catname]}</a>
{if $r[arrchildid]} <!--是否有子栏目--> {pc:content action="category"catid="$r[catid]" num="15" siteid="$siteid"order="listorder ASC" return="data2"} {loop $data2 $v}<!--子栏目循环开始--> <ahref="{$v[url]}">{$v[catname]}</a> {/loop}<!--子栏目循环结束--> {/pc} {/if} {/loop}<!-- 一级栏目循环结束--> {/pc} //-----------------------------------------二级栏目循环导航 单页父级调用内容 {pc:content action="category"siteid="1" catid="$catid" num="1"} {loop $data $n $r} {pc:get sql="SELECT * FROM yong_page wherecatid=$n"} {loop $data $key $val} {$val[content]} {/loop} {/pc} {/loop} {/pc} 单页父级调转到子级 {if $parentid==0} {pc:contentaction="category" siteid="1" catid="$catid"num="1" } {loop $data $n $r} <?phpheader('location:'.$r['url'].'');?> {/loop} {/pc} {/if} 4 三级栏目调用 {pc:content action="category"siteid="1" catid="$catid" } {loop $data $n $r} <p>{$r['catname']}</p> {pc:content action="category"catid="$n" num="33" siteid="$siteid"order="listorder ASC"} <div> {loop $data $r} <ahref="{$r['url']}">{$r['catname']}</a> {/loop} </div> {/pc} {/loop} {/pc} 5 列表标签 {pc:content action="lists"catid="$catid" order="id DESC" thumb=""moreinfo="" num="12"page="$page"} {loop $data $n $r} <li> <a href="{$r['url']}"><img src="{$r['thumb']}"/> <p>{$r['title']}</p><p>{$r['description']}</p> </a></li> {/loop} {/pc} 6 下载标签 {pc:content action="lists"catid="$catid" num="8" order="id DESC"moreinfo="1" page="$page"} {loop$data $r} {php $xiazai = string2array($r['downfiles']);} {loop $xiazai $b} <dl> <dt><img src="{$r['thumb']}" width="154"height="115" /></dt> <dd>{$r['title']}</dd> <dd><a href="{$b[fileurl]}">点击下载</a></dd> </dl> {/loop} {/loop} {/pc} 7 中英文切换代码 一级栏目: {if$parentid ==10} {template"content","header_en"} {else} {template "content","header"} {/if}
二级栏目: {php $lzz=$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][catid]} {if $lzz ==10} {template"content","header_en"} {else} {template "content","header"} {/if} 8 首页推荐代码 {pc:content action="position"posid="2" catid="" order="id DESC"num="6" } {loop $data $n $r}
{/loop} {/pc} 9 友情链接 {pc:link action="type_list"siteid="1" linktype="1" order="listorder DESC"num="4" } {loop $data $n $r} <li> <ahref="{$r['url']}" target="_blank"> <imgsrc="{$r['logo']}"/><p>{$r['name']}</p> </a> </li> {/loop} {/pc} 10 随机文章代码 {pc:content action="lists"catid="10" num="10" order="rand()"return="info"} {loop $info $v} <li><a href="{$v['url']}">{$v['title']}</a> </li> {/loop} {/pc} 11 常用标签 栏目名称:{$CATEGORYS[$catid][catname]} 栏目链接:{$CATEGORYS[31][url]} 栏目图片:{$CATEGORYS[32][image]} 站点域名:{APP_PATH} 时间戳代码:{date('Y-m-dH:i:s',$r[inputtime])} 截取字符:{str_cut($r[title],45,'')} 当前位置:{catpos($catid)} 12 单页父级调用子文章代码 {pc:content action="category"siteid="1" catid="$catid" num="1"} {loop $data $n $r} {pc:get sql="SELECT * FROM gao_page wherecatid=$n"} {loop $data $key $val} {$val[content]} {/loop} {/pc} {/loop} {/pc} 13 列表页使用GET标签调用指定文章内容的方法 {pc:contentaction="position" posid="14" catid="6"order="listorder DESC" num="1"} {loop $data $r} <?php $id = $r['id']; $sql = "SELECT `rencai` FROM `ren_news_data`WHERE `id`='$id' LIMIT 0 , 1"; $query = mysql_query($sql); while($row=mysql_fetch_array($query)){ echo $row[content]; } ?> {/loop} {/pc} 14 子栏目下拿父栏目下的子栏目 {pc:content action="category"catid="$parentid" num="25" siteid="$siteid"order="listorder ASC"} {loop$data $r} <ahref="{$r[url]}">{$r[catname]}</a><span>|</span> {/loop} {/pc} 15 判定当前栏目,让当前栏目高亮 {pc:content action="category"num="25" siteid="$siteid" order="listorder ASC"} <ul> <li {if !$catid }class="now"{/if}><a href="{siteurl($siteid)}">首页</a></li> {loop $data $r} <li{if $r[catid]==$catid}{/if}><ahref="{$r[url]}"title="{$r[catname]}">{$r[catname]}</a></li> {/loop} </ul> {/pc} 16 网站地图 {loop $CATEGORYS $catid $cat} {if$cat['child']} <h3><ahref="{$cat[url]}">{$cat[catname]}</a></h3> <p> {loop $CATEGORYS $childid $c} {php $arrcats = explode(',',$c[arrparentid]);} {if in_array($catid,$arrcats)} {if $c['ismenu']==1} <a href="{$c[url]}">{$c[catname]}</a> {/if} {/if} {/loop} 17 搜索代码 <formaction="index.php?m=search&c=index&a=init"method="get" target="_blank"> <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="1" id="siteid"/> <input name="q" id="q"type="text" value="请输入……"s/> <inputname="submit"type="image" value="" /> </form> |
|
来自: 火炉与猫咪 > 《PHPCMS_V9》