phpcms部分標籤使用說明——kdchxue

來源:互聯網
上載者:User

標籤:des   style   class   tar   ext   get   

1.顯示指定catid的欄目名稱和連結 {$CATEGORYS[25][‘catname‘]}  {$CATEGORYS[25][‘url‘]}
 擷取父欄目id/擷取父欄目名稱 $CATEGORY[$catid][parentid]} 父欄目名稱:{$CATEGORYS[$CAT[parentid]][catname]}

去掉標題限制後出現的省略符號
   {str_cut($r[title],36,‘‘)}

格式化時間 2011-05-06 11:22:33

   {date(‘Y-m-d H:i:s‘,$r[inputtime])}

   {date(‘Y年m月d日‘,$r[inputtime])}

------------------------------------------------------------------------------------------------------

2.調用子欄目(在欄目首頁模板需要用到,列表頁也可以用到)

   {pc:content action="category" catid="$catid" num="25"siteid="$siteid" order="listorder ASC"}
    {loop $data$r}

       <ahref="{$r[url]}">{$r[catname]}</a>|
   {/loop}{/pc}
------------------------------------------------------------------------------------------------------

3.得到指定欄目下的新聞

  (1)這裡moreinfo="1"表示主副表關聯起來 可以直接使用
           {pc:content action="lists" catid="$catid" num="25" order="id DESC"return="info" moreinfo="1"} 
             {loop $info $r}
            更新日期:{date(‘Y年m月d日‘,$r[updatetime])}
            {$r[username]}
            來源:{$r[copyfrom]}
            點擊率{$r[readpoint]}
            網址{$r[url]}
            文章標題 {$r[‘title‘]}
            標題樣式{title_style($v[style])}
                      
   {/loop}
    {/pc}

<p>=====================</p
  (2)sql萬能語句可以調用指定內容 更方便
{pc:get sql="select * from v9_news as a,v9_news_data as b wherea.id=b.id and catid=34 and status=99 order by a.id desc"}
    {loop $data $v} 
 <li><ahref="{$v[‘url‘]}"target="_blank"><imgsrc="{$v[thumb]}" width="146" height="117"/></a></li>            
   {/loop}
    {/pc}

   {pc:get sql="select * fromv9_news where catid=10 and status=99 order by updatetime desc"num="5" start="23"}
  {loop $data $rs}
     <a href="{$rs[‘url‘]}" title="{$rs[‘title‘]}"target="_blank">{$rs[‘title‘]}</a>
    {/loop}
 {/pc}

<p>=====================</p
   (3)文章從指定位置開始調用(position推薦位使用)
   起始位置為5,調用3條。相當於limit功能。

   {pc:content  action="position" posid="27"order="listorder DESC" num="3" start="5"}
       {loop $info $r}
               <a href=‘{$r[url]}‘>{str_cut($r[description],115)}...</a>
      {/loop}
    {/pc}
 或{pc:content action="lists"  catid="54" thumb=""  order="listorder DESC" start="3" num="5"} thumb="" 不分類

<p>=====================</p>迴圈列表新聞
 
  <divclass="content">
        {pc:content  action="position"posid="9" order="listorder DESC" num="4"}
         {loop $data $r}
             <a href="{$r[url]}"title="{$r[title]}">{str_cut($r[title],36,‘‘)}</a>{date(‘Y-m-dH:i:s‘,$r[inputtime])}
               <p>{if $n==1}<imgsrc="{thumb($r[thumb],90,60)}" width="90"height="60"/>{/if}{str_cut($r[description],112,‘‘)}<ahref="{$r[url]}">[readingmore]</a></p>
               
              {/loop} 
            {/pc}  
           </div>
<p>=====================</p>
(4).有分頁效果
    {pc:getsql="select * from wecheweyounews where hour=$hour order by iddesc" return="data" num="50" page="$page"}
               <ul >
       {loop $data $r}
                   <li><spanclass="left">&middot;<ahref="{$r[‘url‘]}"target="_blank">{str_cut($r[‘title‘],60)}</a>(編輯:{$r[username]})</span><spanclass="right">{date("Y-m-d",$r[‘inputtime‘])}</span></li></li>
               <?php
               if($n%5==0 and $n<50) echo"</ul><ul>";
               ?>
       {/loop}
               </ul>
           </div>
     <div id="pages"class="text-c">{$pages}</div>
    {/pc} 
------------------------------------------------------------------------------------------------------
4. <!--首頁焦點圖推薦 就圖片切換那個東西-->
{pc:content  action="position"posid="1"  order="listorder DESC" thumb="1"num="5"}
 {loop $data $r}
  <a href="{$r[‘url‘]}"title="{str_cut($r[‘title‘],30)}"><imgsrc="{thumb($r[‘thumb‘],300,200)}" alt="{$r[‘title‘]}" width="310"height="260"/></a>
   {/loop}
    {/pc}

 

5分頁
 

前台調用num="50"指每頁50條記錄
    {pc:getsql="select * from wecheweyounews where hour=$hour order by iddesc" return="data" num="50" page="$page"}
               <ul >
       {loop $data $r}
                   <li><spanclass="left">&middot;<ahref="{$r[‘url‘]}"target="_blank">{str_cut($r[‘title‘],60)}</a>(編輯:{$r[username]})</span><spanclass="right">{date("Y-m-d",$r[‘inputtime‘])}</span></li></li>
               <?php
               if($n%5==0 and $n<50) echo"</ul><ul>";
               ?>
       {/loop}
               </ul>
           </div>
     <div id="pages"class="text-c">{$pages}</div>
    {/pc}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.