phpcms基本語句的用法

來源:互聯網
上載者:User

標籤:menu   程式   lists   head   time   ==   blog   span   content   

最近在做企業站,這裡將phpcms裡的常用語句總結一下:

1、頭部:

<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" /><title>{if isset($SEO[‘title‘]) && !empty($SEO[‘title‘])}{$SEO[‘title‘]}{/if}{$SEO[‘site_title‘]}</title><meta name="keywords" content="{$SEO[‘keyword‘]}"><meta name="description" content="{$SEO[‘description‘]}">

2、常用系統常量: {CSS_PATH} {JS_PATH} {IMG_PATH} {APP_PATH}//程式目錄

3、頭尾替換:

{template "content","header"}{template "content","footer"}

4、常用調用資料:

{pc:content action="lists" catid="6" num="8" order="inputtime DESC" }{loop $data $r}<li><span class="date">({date(‘Y/m/d H:m:s‘,$r[inputtime])})</span><a href="{$r[url]}" target="_blank" title="{$r[title]}">{str_cut($r[title],‘28‘)}</a></li>{/loop}{/pc}

5、推薦位調用:

{pc:content action="position" posid="1" order="listorder DESC" num="5"}{loop $data $r}<li><a href="{$r[url]}" target="_blank"><img src="{$r[thumb]}" text="{$r[title]}" alt="{$r[title]}" width="727" height=‘243‘ /></a></li>{/loop}{/pc}

6、一級欄目調用:

{pc:content action="category" catid="0" num="8" siteid="$siteid" order="listorder ASC"}{loop $data $r}<li><a href="{$r[url]}" title="{$r[catname]}">{$r[catname]}</a></li>{/loop}{/pc}

7、文章列表頁調用關鍵字,或者首頁調用關鍵字::

{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}{loop $data $r}<a href="{$r[url]}">{$r[title]}</a>php $keywords = explode(‘,‘,$r[keywords]);}<b>文章標籤:</b>{loop $keywords $keyword}<a href="{APP_PATH}index.php?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}" class="blue"> {$keyword}</a>{/loop}{/loop}{/pc}

8、判斷是否為首頁:

{if $top_parentid==0}//首頁地址<a href="{siteurl($siteid)}"><div class="menu menu_sel">首頁</div></a>{else}<a href="{siteurl($siteid)}"><div class="menu">首頁</div></a>{/if}

9、取瀏覽數:

span id="hits"></span>次<!--瀏覽數的js--><script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>

10、友情連結:

{pc:link action="type_list" typeid="0" siteid="1" linktype="1" order="listorder DESC" num="8"}{loop $data $v}<a href="{$v[‘url‘]}" title="{$v[‘name‘]}" target="_blank">{$v[‘name‘]}</a>{/loop}{/pc}

11、調用單頁內容:

pc:get sql="SELECT content FROM v9_page where catid=‘6‘" return="data"}{loop $data $r}{str_cut(strip_tags($r[content]), 160)}{/loop}{/pc}

12、顯示上一頁和下一頁:

<strong>上一篇:</strong><a href="{$previous_page[url]}">{$previous_page[title]}</a><br /><strong>下一篇:</strong><a href="{$next_page[url]}">{$next_page[title]}</a>

 

phpcms基本語句的用法

聯繫我們

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