你现在的位置:首页 > PHP网站建设知识库 > phpcms > 正文

几个phpcms v9的get语句

phpcms v9的帮助文件里的get调用学习内容太少,对初学者来着太浮云了。比如调用最新贴,最新评论贴,等等,因为新手需要多几个例子来研究学习。v9后台模板的get语句输入的地方,太过于简单,还是得自己写.

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


{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}
{$r[title]}
{/loop}
{/pc}

 

多个栏目调用

{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}

 

热门搜索


{pc:get sql="select keyword from v9_search_keyword"  orderby="searchnums desc" num="5" cache="3600"}
   {loop $data $r}
{$r[keyword]}

         {/loop}
   {/pc}

 

热门关键词调用

{pc:get sql="select keyword from v9_search_keyword"  orderby="searchnums desc" num="5" cache="3600"}
   {loop $data $r}
{$r[keyword]}

         {/loop}
   {/pc}

 

get 分页肯定能用!


{get sql="SELECT contentid,catid,title,style,thumb,keywords,description,userid,updatetime,islink,inputtime,url FROM 

`phpcms_content` WHERE status=99 AND `catid` = $catid ORDER BY contentid DESC" rows="8" page="$page"catid="$catid"}

 

 

 

 

 

 

 

 

 

  • {str_cut($r[title], 27,'')}

  • {/get}
    {$pages}

     

     

     

     

     

     

     

     

     

     


    在首页某模型所有栏目最新文章调用带栏目名称
               {pc:get sql="select * from v9_convert_news where status=99 order by id desc" num="11"}
    {loop $data $v}

     

     

     

     

     

     

     

     

     

  • {str_cut($CATEGORYS[$v

     

    [catid]][catname],45,'...')}

  •  

     

     

     

     

     

     

     

     


     

     

     

     

     

     

     

     

     


  • | {str_cut($v[title],90)}

  • {/loop}
    {/pc}