dede调取三级栏目名及栏目下的内容列表的方法
<p><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>网站根据需要,把地区划成省-市-文章的层级结构,栏目首页需要显示的是 </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
{dede:channelarclist} <!--省显示--> <br>
<a href="">省级标题:{dede:field name='name'/}</a> <br>
{dede:channel type='son'} <br>
<a href="">市级标题:</a> <br>
{dede:arclist} <br>
该市文章{field:title/} <br>
{/dede:arclist} <br>
{/dede:channel} <br>
{/dede:channelarclist} </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>即把省级栏目按市分类,并显示每一个市的文章标题,但是{dede:channel}标签不能嵌套,因此{dede:arclist}标签会原样输出,解决的办法: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
$typeid = $row['id']; <br>
if((class_exists('PartView'))) <br>
{ <br>
$pv = new PartView($typeid); <br>
$text = $likeType; <br>
$text= str_replace(array('{field', '/}'), array(''), $text); <br>
$pv->SetTemplet($text,'string'); <br>
$artlist = $pv->GetResult(); <br>
$likeType = $artlist; <br>
} </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>在/include/taglib/channel.lib.php 中找到if($col>1) $likeType .= "</dd>\r\n"; (v5.6 是125行 v5.7是156行)在这句话上面加上上面的代码 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>问题解决。 </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>有人反应,加了这代码之后,文章页有{dede:channel} {/dede:channel} 这个的时候更新不了,于是可以看了下代码,可以改成这样: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
if($sanji) <br>
{ <br>
$typeid = $row['id']; <br>
if((class_exists('PartView'))) <br>
{ <br>
$pv = new PartView($typeid); <br>
$text = $likeType; <br>
$text= str_replace(array('{field', '/}'), array(''), $text); <br>
$pv->SetTemplet($text,'string'); <br>
$artlist = $pv->GetResult(); <br>
$likeType = $artlist; <br>
} <br>
} </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>然后在channel.lib.php文件的开头 global $dsql; 的后面加上$sanji = $ctag->GetAtt('sanji'); </span><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>调用的时候变成: </span></p>
<div class="msgheader" style='margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";'>
<p class="right">
<span><u>复制代码</u></span></p>
<p>
代码如下:</p>
</div>
<p class="msgborder" style='margin: 0px auto 3px; padding: 0px 3px; outline: none; line-height: 25.2px; font-size: 14px; clear: both; border-right: 1px solid rgb(0, 153, 204); background: rgb(221, 237, 251); overflow: hidden; border-left: 1px solid rgb(0, 153, 204); word-break: break-all; border-bottom: 1px solid rgb(0, 153, 204); word-wrap: break-word; font-family: tahoma, arial, "Microsoft YaHei";'>
<br>
{dede:channelartlist} <br>
{dede:field name='typeurl'/} {dede:field name='typename'/} //外框架 <br>
{dede:channel type='sun' sanji='1'}//子框架 <br>
<h3><a href="" target="_blank"></a></h3> <br>
{dede:arclist row='5' titlelen='39'} //调用文章 <br>
连接: {field:arcurl/} <br>
标题: {field:title/} <br>
{/dede:arclist} <br>
{/dede:channel} <br>
{/dede:channelartlist} </p>
<p>
<br style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'><span style='font-family: tahoma, arial, "Microsoft YaHei"; font-size: 14px;'>问题解决。</span></p>
頁:
[1]