{pc:content action="lists" catid="$catid" num="25" order="id DESC" page="$page" moreinfo="1"} <ul class="list lh24 f14"> {loop $data $r} <li><span class="rt">{date(‘Y-m-d H:i:s‘,$r[inputtime])}</span>·<a href="{$r[url]}" target="_blank"{title_style($r[style])}>{$r[title]}</a> <?php $id = $r[‘id‘]; $sql = "SELECT `content` FROM `cmsyou_news_data` WHERE `id`=‘$id‘ LIMIT 0 , 1"; $query = mysql_query($sql); while($row=mysql_fetch_array($query)){ echo $row[content]; } ?> </li> {if $n%5==0}<li class="bk20 hr"></li>{/if} {/loop} </ul> <div id="pages" class="text-c">{$pages}</div> {/pc}
其中,下面这段代码调用了对应的Content:
<?php $id = $r[‘id‘]; $sql = "SELECT `content` FROM `cmsyou_news_data` WHERE `id`=‘$id‘ LIMIT 0 , 1"; $query = mysql_query($sql); while($row=mysql_fetch_array($query)){ echo $row[content]; } ?>
是直接用SELECT调用指定数据表的对应id内容。
时间: 2024-10-24 00:16:54