今天在给一客户做网站时,因为客户内容不多,所以列表页想弄成两栏布局,左栏显示最新文章,右栏显示第一篇文章内容,查找了资料,可以直接用下面的标签调用出来,标签如下:
{pc:content action="lists" order="id DESC" num="1" moreinfo="1"}
{loop $data $key $val}
标题:{$val['title']}
内容:{$val['content']}
{/loop}
{/pc}
但是又想固定显示某篇文章,研究了一下只能用推荐位来实现,但是推荐位不能调用附表,所以只能用GET标签了,标签如下:
{php $j=$catid;}
{pc:get sql="select `d`.`content` from `v9_jc8883_data` as `d` left join `v9_position_data` as `p` on `d`.`id`=`p`.`id` where `p`.`posid`='14' and `p`.`catid`='$j' order by `d`.`id` desc" num="10"}
{loop $data $r}
{$r[content]}
{/loop}
{/pc}
或者下面的标签页可以:
{pc:content action="position" posid="14" catid="59" order="listorder DESC" num="1"}
{loop $data $r}
<?php $id = $r['id'];
$sql = "SELECT `content` FROM `v9_jc8883_data` WHERE `id`='$id' LIMIT 0 , 1";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
echo $row[content];
}
?>
{/loop}
{/pc}
关键是moreinfo="1",把附表的内容页调出来。
http://v9.help.phpcms.cn/html/2010/modules_0916/33.html#lists