dedecms,织梦,搞笑段子,织梦伪静态规则,织梦全站伪静态,织梦手机版伪静态

织梦DEDECMS三级栏目调用

工作手记 baishitou 35℃ 0评论

后台栏目

bst20181024094547

效果

bst20181023121623

调用代码

 {dede:channelartlist typeid=24}
                <li class="a1">
                    <div class="tx"><a href="{dede:field.typeurl/}">{dede:field name='typename'/}</a> </div>
                    <dl>
                    {dede:channel type='son'}
                    <dd> <a href="#">[field:typename/]</a><span>/</span> </dd>
                    {/dede:channel}
                  </dl>
                    <div class="pop"> {dede:channel type=son noself=yes}
                    <dl>
                        <dt><a href="[field:typeurl/]"  title="[field:typename/]">[field:typename/] ></a></dt>
                        <dd> [field:id runphp=yes]
                        global $dsql;
                        $sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid=@me And ishidden<>1 order by sortrank asc limit 0,10";
                        $dsql->SetQuery($sql);
                        $dsql->Execute('t');
                        $result = '';
                        while($row = $dsql->GetArray('t'))
                        {
                        $typename = $row['typename'];
                        $typeurl = GetOneTypeUrlA($row);
                        $result .= "<a href='{$typeurl}' class='ui-link'>{$typename} |</a>";
                        }
                        @me = $result;
                        [/field:id] </dd>
                      </dl>
                    <div class="clr"></div>
                    {/dede:channel}</div>
                  </li>
                {/dede:channelartlist} 

以上代码是根据下面代码修改的。你根据实际情况修改

一级、二级、三级、四级标签嵌套法

<ul>
	{dede:channelartlist row=7 typeid=top}
	<!-- 顶级 -->
	<li class="top">
		<a href="{dede:field.typeurl/}" >{dede:field name='typename'/}</a>
		<ul class="sub">
		{dede:channel type=son noself=yes}
		<!-- 二级 -->
		<li>
			<a href="[field:typeurl/]"  title="[field:typename/]">[field:typename/]</a>
			<ul>
				<!-- 三级 -->
				[field:id runphp=yes]
				global $dsql;
				$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid=@me And ishidden<>1 order by sortrank asc limit 0,10";
				$dsql->SetQuery($sql);
				$dsql->Execute('t');
				$result = '';
				while($row = $dsql->GetArray('t'))
				{
					$typename = $row['typename'];
					$typeurl = GetOneTypeUrlA($row);
					$result .= "<li><a href='{$typeurl}'>{$typename}</a></li>";
				}
				@me = $result;
				[/field:id]
			</ul>
		</li>
		{/dede:channel}
		</ul>
	</li>    
	{/dede:channelartlist}
</ul>

上面的是输出到三级栏目,如果需要四级栏目可以这样修改三级四级

<!-- 三级/四级 -->
[field:id runphp=yes]
global $dsql;
$sql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid=@me And ishidden<>1 order by sortrank asc limit 0,10";
$dsql->SetQuery($sql);
$dsql->Execute('t');
$result = '';
while($row = $dsql->GetArray('t'))
{
    $row['typeurl'] = GetOneTypeUrlA($row);
	$result .= "<a href='{$row[typeurl]}'>{$row[typename]}</a>";
	//四级
	$nsql = "Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid=$row[id] And ishidden<>1 order by sortrank asc limit 0,10";
	$dsql->SetQuery($nsql);
	$dsql->Execute('n');
	while($nrow = $dsql->GetArray('n'))
	{
		$nrow['typeurl'] = GetOneTypeUrlA($nrow);
		$result .= "<a href='{$nrow[typeurl]}'>{$nrow[typename]}</a>";
	}
}
@me = $result;
[/field:id]

 

转载请注明:白石头博客 » 织梦DEDECMS三级栏目调用

喜欢 (1)or分享 (0)

您必须 登录 才能发表评论!