標籤: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基本語句的用法