zdcms建设网站时想要判断主栏目下是否包含子栏目,模板标签应该怎么写呢?具体请看下面的代码:
{category module=share pid=0 return=c1}
<li><a href="{$c1.url}">{$c1.name}</a> <!--主栏目名称和链接-->
{if $c1.child} <!--判断主栏目下是否存在子栏目-->
{category module=share pid=$c1.id return=c2}
<li><a href="{$c2.url}">{$c2.name}</a> <!--子栏目名称和链接-->
{/category}
{else}
没有子栏目
{/if}
{/category}根据以上代码就可以在循环栏目时判断父栏目是否包含子栏目,然后显示你想要的提示信息了。如果遇到过类似的问题,就试试看吧。