phpcms調用指定文章內容模型的ID

來源:互聯網
上載者:User

標籤:tar   echo   靈活   指定   lan   strong   text   replace   net   

一、使用GET調用Phpcms V9指定id頁面資料方法


{pc:get sql="SELECT * FROM cmsyou_news WHERE id=‘55‘" cache="3600" return="data"}
{loop $data $val}
{$val[content]}
{/loop}
{/pc}

 

二:直接使用GET標籤調用:

{PHP $j=$catid;}
{pc:get sql="select `d`.`content` from `aspku_news_data` as `d` left join `aspku_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}

這種方式,需要注意修改資料表的名稱、調用的id和數量num等參數。

三:推薦位元據中套用GET標籤:

{pc:content action="position" posid="14" catid="59" order="listorder DESC" num="1"}
{loop $data $r}
< ?php $id = $r[‘id‘];
$sql = "SELECT `content` FROM `aspku_news_data` WHERE `id`=‘$id‘ LIMIT 0 , 1";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
echo $row[content];
}
?>
{/loop}
{/pc}

這種方式可以後台控制推薦位資訊,更靈活;需要註冊的是:需要加上moreinfo="1",把附表的內容頁調出來。

 

次篇部落格轉自      a1079540945

phpcms調用指定文章內容模型的ID

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.