织梦DEDECMS依据标签调用相干浏览
摘要:织梦DEDECMS依据标签调用相干浏览
织梦DEDECMS依据标签调用相干浏览
<div class=”tag”>
<p>相干浏览: {dede:field.id function=”listtag(@me)” /}</p>
<ul>
{dede:php}
$sql1 = “select tag from `yh_taglist` where aid = $id”;
$tags = array();
$dsql->Execute(‘me’,$sql1);
while($row1 = $dsql->getarray())
{
$tags[] = $row1;
}
for($i=1;$i<strlen($tags);$i++){ if(!empty($tags[$i]['tag'])){$where.=” or title like ‘%{$tags[$i]['tag']}%’”;}}
$sql2 = “select title,typeid,id from `yh_archives` where title like ‘%{$tags[0]['tag']}%’ $where and id <> $id order by pubdate desc limit 0,10″;
$dsql->Execute(‘me’,$sql2);
while($row2 = $dsql->getarray()){
$sql3 = “select typedir from `yh_arctype` where id = {$row2['typeid']}”;
$dir = $dsql->getone($sql3);
echo ‘<li><a href=”’.$dir['typedir'].’/’.$row2['id'].’.html”>’.$row2['title'].’</a></li>’;
}
{/dede:php}
</ul>
</div>
<p>相干浏览: {dede:field.id function=”listtag(@me)” /}</p>
<ul>
{dede:php}
$sql1 = “select tag from `yh_taglist` where aid = $id”;
$tags = array();
$dsql->Execute(‘me’,$sql1);
while($row1 = $dsql->getarray())
{
$tags[] = $row1;
}
for($i=1;$i<strlen($tags);$i++){ if(!empty($tags[$i]['tag'])){$where.=” or title like ‘%{$tags[$i]['tag']}%’”;}}
$sql2 = “select title,typeid,id from `yh_archives` where title like ‘%{$tags[0]['tag']}%’ $where and id <> $id order by pubdate desc limit 0,10″;
$dsql->Execute(‘me’,$sql2);
while($row2 = $dsql->getarray()){
$sql3 = “select typedir from `yh_arctype` where id = {$row2['typeid']}”;
$dir = $dsql->getone($sql3);
echo ‘<li><a href=”’.$dir['typedir'].’/’.$row2['id'].’.html”>’.$row2['title'].’</a></li>’;
}
{/dede:php}
</ul>
</div>