Destoon tag loop 标签循环中调取内容$content

分类栏目:destoon实战

142

destoon {$t[content]} 无效。 destoon 将内容表与标题表区分开来以便获取查询的高性能。tag标签就是专门调取标题表中字段信息的。 但有时候我们希望tag标签中能获取到内容表的信息。看来只有改装一下tag标签了(给tag功能打补丁)。 改装后,由参数控制开关,不影响原有调用方法的功能和性能。
打开 /include/tag.func.php 找到  isset($showpage) or $showpage = 0;
这句。 在其上行或其下行添上 (isset($showcontent) && $MODULE[$moduleid]['module']=='article') or $showcontent = 0;
 #我的补丁 找到  $query = "SELECt ".$fields." FROM ".$table." WHERe ".$condition.$order." LIMIT ".$offset.",".$pagesize;
这句。 替换成 # 补丁开始if($showcontent){  $query = "SELECt t.".preg_replace('/,\s*/im','t.',$fields).",c.`content` FROM ".$table." as t left join ".preg_replace('/(\d+)$/','data_$1',$table)." as c on t.itemid=c.itemid WHERe ".$condition.$order." LIMIT ".$offset.",".$pagesize;}else{  $query = "SELECT ".$fields." FROM ".$table." WHERe ".$condition.$order." LIMIT ".$offset.",".$pagesize;}# 补丁结束
然后再模板页中使用 <!--{tag("moduleid=21&condition=status=3&pagesize=10&showcontent=1&template=list-mytpl")}-->
然后再tag循环列表模板页中使用 <ul>
{loop $tags $i $t}
<li><a title="{$t[title]}" src="">{$t[title]}<br/>{$t[content]}</a></li>
{/loop}
</ul>
大功告成