今天是

爱酷家


当前位置:首页 > 站长学院 > 其他教程

phpcms v9模板制作常用get标签分享

收集整理   发布时间:2012-11-29 20:00:00   阅读

phpcms v9模板制作常用get标签分享

1、全站多模型联合调用最新文章

    {pc:get

    sql="SELECT id,url,title,status,inputtime from v9_news WHERE status=99

    UNION SELECT id,url,title,status,inputtime from v9_picture WHERE status=99

    UNION SELECT id,url,title,status,inputtime from v9_flashgame WHERE status=99

    ORDER BY inputtime DESC" num="10"}

    {loop $data $r}

    <a href="{$r[url]}" title="{$r[title]}" target="_blank">{$r[title]}</a>

    {/loop}

    {/pc}

 

2、多个栏目调用

{pc:get sql="SELECT `n`.`inputtime`,`n`.`url`,`n`.`title`,`c`.`catname`,`c`.`url` as `c_url` FROM `v9_news` as `n` left join `v9_category` as `c` on `n`.`catid` = `c`.`catid` where `c`.`catid` in (18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) order by `n`.`id` desc" num="10"  return="data"}
{loop $data $key $val}{date('Y-m-d H:i:s',$val[inputtime])}[{$val[catname]}] {$val[title]}

{/loop}
{/pc}

3、热门搜索 

{pc:get sql="select keyword from v9_search_keyword"  orderby="searchnums desc" num="5" cache="3600"}
   {loop $data $r}
<a href="{APP_PATH}index.php?m=search&c=index&a=init&typeid=1&siteid=1&q={$r[keyword]}" target="_blank">{$r[keyword]}</a>


         {/loop}
   {/pc}

 

4、热门关键词调用
 

{pc:get sql="select keyword from v9_search_keyword"  orderby="searchnums desc" num="5" cache="3600"}
   {loop $data $r}
<a href="{APP_PATH}index.php?m=search&c=index&a=init&typeid=1&siteid=1&q={$r[keyword]}" target="_blank">{$r[keyword]}</a>

         {/loop}

   {/pc}

5、get 分页肯定能用的

    {get sql="SELECT contentid,catid,title,style,thumb,keywords,description,userid,updatetime,islink,inputtime,url FROM `content` WHERE status=99 AND `catid` = $catid ORDER BY contentid DESC" rows="8" page="$page"catid="$catid"}
    <li><a href="{$r[url]}"><img src="{$r[thumb]}" width="125" height="200" border="0" alt="{$r[title]}" /></a><br /><a href="{$r[url]}" title="{$r[title]}" target="_blank">{str_cut($r[title], 27,'')}</a></li>
    {/get}
    {$pages}

 

6、在首页某模型所有栏目最新文章调用带栏目名称

    {pc:get sql="select * from v9_convert_news where status=99 order by id desc" num="11"}
    {loop $data $v}
    <li style="text-align:center;"><a href="{$CATEGORYS[$v[catid]][url]}" style="font-size:12px; color:#F30">{str_cut($CATEGORYS[$v[catid]][catname],45,'...')}</a></li>
    <li style="width:280px;">
    | <a href="{$v['url']}" title="{$r[title]}" target="_blank">{str_cut($v[title],90)}</a></li>
    {/loop}
    {/pc}



注:⊙如转载本站原创作品,请务必包保留本文地址:

内容: