关于phpcms 调用数据的问题

来源:百度知道 编辑:UC知道 时间:2024/06/05 00:44:59
我主要是想实现图文调用,就是想实现如图那样的效果,希望左边能出现第一条新闻的图片,右边列出最新的新闻标题。

如果光是用get,如下:{get sql="select * from phpcms_content where catid=40 and status=99 and `thumb`!='' order by inputtime desc" rows="1"}
根本达不到我要的效果,这个语句就会把每一条新闻的图片和标题都弄出来,有人说可以结合loop循环,可以我加上之后如下:
{get sql="select * from phpcms_content where catid=40 and status=99 and `thumb`!='' and description!='' order by inputtime desc" rows="1"}
{loop $data $n $r}
<A href="{$r[url]}" target="_blank"> {str_cut($r[title],48)}</A>
{/loop}
{/get}

这样连内容都调不出了,更谈不上图片与文字分类,请问有什么办法做到下图的效果?

用标签最方便,如果不愿意用标签,就稍麻烦一点了,写三次 get 语句也可以呀!
第一次写图,第二次写焦点那一条,第三次写那4条推荐
{get sql="select * from phpcms_content where catid=40 and status=99 and `thumb`!='' order by inputtime desc" rows="1"}
<img src="{$r[thumb]}" alt="{$r[title]}"><br/>
{$r[title]}
{/get}
{get sql="select * from phpcms_content a,phpcms_congent_position b where a.contentid=b.contentid and b.posid=2 a.catid=40 and status=99 order by inputtime desc" rows="1"}
<li>{$r[title]}</li>
{/get}
{get sql="select * from phpcms_content a,phpcms_congent_position b where a.contentid=b.contentid and b.posid=1 a.catid=40 and status=99 order by inputtime desc" rows="4"}
<li>{$r[title]}</li>
{/get}