DEDECMS实现在标签中嵌套调用SQL的方法
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>本文以实例讲述了DEDECMS实现在标签中嵌套调用SQL的方法,对于dedecms的二次开发来说非常简单实用,实例代码如下所示:</p>
<p style='margin: 0px; padding: 5px 0px; outline: none; font-size: 14px; line-height: 30px; font-family: tahoma, arial, "Microsoft YaHei";'>
</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";'>
<div class="right">
<span><u>复制代码</u></span>
</div>
代码如下:</div>
<div class="msgborder" id="phpcode1" 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";'>
{dede:field.id runphp='yes'}<br>
$tsql = new DedeSql(false);<br>
$tsql->SetQuery("select * from dede_archives where id=@me");<br>
$tags = "";<br>
$tsql->Execute('t');<br>
while($row = $tsql->GetArray('t',MYSQL_ASSOC)){<br>
$tags .= $row['title'];<br>
}<br>
@me = $tags;<br>
{/dede:field.id}</div>
頁:
[1]