獲取父分類下面的子分類
{loop subcat(77) $k $v}
{php $subcatid[] = $k;}
{/loop}
<?php $subcatid = implode(',', $subcatid);?> 結果可以用在sql 的in子句中
{template "content","header"}
調用根目錄下phpcms\template\content\header文件
{template "content","footer"}
調用根目錄下phpcms\template\content\footer文件
{CHARSET}
字符集 (gbk或者utf-8)
{if isset($SEO['title']) && !empty($SEO['title'])} {$SEO['title']}{/if} {$SEO['site_title']} {$SEO['keyword']} {$SEO['description']}
標題和標題seo優化
{CSS_PATH}
地址替換為根目錄下\statics\css
{JS_PATH}
地址替換為根目錄下\statics\js
{pc:content action="position" posid="9" order="id" num="10" cache="3600"}
pc標簽{pc:content 參數名="參數值"參數名="參數值"參數名="參數值"}
{loop $data $k $v}
<li><a href="{$v[url]}">{$v[title]}</a></li>
{/loop}
pc標簽值
action="position"--------------對話框的類型=“內容推薦位列表” posid="9"----------------------推薦位ID="9" order="id"---------------------排序類型="id" num="10" ----------------------數據調用數量="10" cache="3600"-------------------緩存="3600"毫秒 {get_siteid()} {IMG_PATH} 圖片替換 action="hits" 排行,熱點等 action="lists" 主要用于列表等。 catid="$catid" 當前欄目ID 指定數字,即為指定的欄目 num="" 調用文章的數量 order="id DESC" 按ID降序排列 order="id ASC" 按ID升序排列 "views DESC" sort="" "1" 縮略圖 return="" page="$page" 需要分頁
每當列表幾行的時候出現一次這個
{if $num%2==0} {/if}
循環標簽
{loop $data $r} {/loop} {loop $info $r} {/loop}
日期-------------{date('Y-m-d H:i:s',$r[inputtime])}
文章鏈接------{$r[url]}
文章標題------{$r[title]}
標題截取------{str_cut($r[title],40,'...')}
縮略圖---------loop是info的時候用 {thumb($r[thumb],110,0)} loop是data的時候用{thumb($v[thumb],90,0)}
分頁標簽------{$pages}
文章頁標簽
標題-------{$title}
內容-------{$content}
日期-------{$inputtime}
來源-------{$copyfrom}
點擊數------<span id="hits"></span>
<script language="JavaScript" src="{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}"></script>
網站首頁----------------{siteurl($siteid)}
當前位置----------------{catpos($catid)}
欄目名稱----------------{$CAT[catname]}
欄目拼音----------------{$CAT[letter]}
欄目鏈接----------------{$CAT[url]}
父欄目名稱--------------{$CATEGORYS[$CAT[parentid]][catname]}
父欄目鏈接--------------{$CATEGORYS[$CAT[parentid]][url]}
上上級欄目名稱--------{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][catname]}
上上級欄目鏈接--------{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][url]}
一級父欄目列表(catid=0)
{pc:content action="category" catid="0" num="34" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
同級欄目列表
{pc:content action="category" catid="$parentid" num="12" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li><a href="{$r[url]}">{$r[catname]}</a></li>
{/loop}
{/pc}
組圖列表
{loop $photos $r}
<li><a href="{$r[url]}"><img src="{thumb($r[url], 75, 45, 0)}" alt="{$r[alt]}" /></a></li>
{/loop}
注釋:其中$photos為自定義組圖字段,{$r[url]}為圖片地址,{thumb($r[url], 75, 45, 0)}為圖片縮略圖,{$r[alt]}為圖片描述
將index.html的頭和尾拆分出來,分別放在header.html和footer.html文件夾中,這三個文件放在
,用{IMG_PATH}images,{CSS_PATH}css,{JS_PATH}js來替換原來的路徑。
header.html
標題的替換代碼
1
|
<title>{ if isset( $SEO [ 'title' ]) && ! empty ( $SEO [ 'title' ])}{ $SEO [ 'title' ]}{/ if }{ $SEO [ 'site_title' ]}</title> |
頭部導航菜單的替換代碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<div class = "header-items" > { if $top_parentid ==0} <!--判斷是不是首頁--> <a href= "{siteurl($siteid)}" > <div class = "h-item select" >首頁</div> </a> { else } <a href= "{siteurl($siteid)}" > <div class = "h-item " >首頁</div> </a> {/ if } {pc:content action= "category" catid= "0" num= "6" siteid= "$siteid" order= "listorder ASC" } {loop $data $r } { if $catid == $r [catid] || $top_parentid == $r [catid]} <div class = "h-item2" >/</div> <a href= "{$r[url]}" > <div class = "h-item select" >{ $r [catname]}</div> </a> { else } <div class = "h-item2" >/</div> <a href= "{$r[url]}" > <div class = "h-item" >{ $r [catname]}</div> </a> {/ if } {/loop} {/pc} </div> |
index.html頁面
大圖的替換代碼
1
2
3
4
5
6
7
8
9
10
11
|
<!--大圖 開始--> <div class = "bigimg" > {pc:content action= "lists" catid= "9" order= "id DESC" num= "1" } {loop $data $val } <img src= "{$val['thumb']}" /> <!--thumb代表縮略圖--> <!--catid 是指欄目下的內容 我把圖片放到9的位置 所以catid= "9" --> {/loop} {/pc} </div> <!--大圖 結束--> |
點擊圖片進入某個標題的代碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
<!--三項 開始--> <div style= "width: 100%; height: 30px;" ></div> <div class = "three" > <div class = "three-item" > <!--13代表的是欄目代號--> <a href= "{$CATEGORYS[13][url]}" > <img src= "{IMG_PATH}images/three1.png" ></a> </div> <div class = "three-item" > <a href= "{$CATEGORYS[11][url]}" > {pc:content action= "lists" catid= "16" order= "id DESC" num= "1" } {loop $data $val } <img src= "{$val['thumb']}" style= "height: 115px" > <!--thumb代表縮略圖--> <!--catid 是指欄目下的內容 我把圖片放到9的位置 所以catid= "9" --> {/loop} {/pc} </a> </div> </div> |
展示項替換代碼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
<!--展示項--> {pc:content action= "lists" catid= "14" order= "id DESC" num= "4" } {loop $data $val } <div class = "dt-item" > <a href= "{$val[url]}" > <div class = "dt-item-title" >{ $val [title]}</div> </a> <div class = "dt-item-context" > { $val [description]} </div> </div> {/loop} {/pc} |
展示項代碼2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<!--優秀產品展示 開始--> <div class = "yxxm" > <div class = "yxxm-title" >優秀產品展示</div> {pc:content action= "lists" catid= "10" order= "id DESC" num= "6" moreinfo= "1" } {loop $data $val } <!--展示項--> <div class = "yxxm-item" > <a href= "{$val[url]}" > <img src= "{$val[thumb]}" ></a> <div class = "yxxm-name" > 項目名稱: <span>{ $val [title]}</span> </div> <div class = "yxxm-user" > 客 戶: <span>{ $val [keywords]}</span> </div> <div class = "yxxm-context" > 功 能: <span style= "width: 77%;" >{ $val [description]}</span> </div> <div class = "yxxm-context" > 開發人員: <span> {php list( $copyfrom )= explode ( '|' , $val [ 'copyfrom' ])} { $copyfrom } <!--上面的意思是引自來源,吧|0去掉--></span></div></div></div> |
1
|
|
1
2
3
4
5
6
|
{/loop} {/pc} |
以此段div為例,了解時間的添加代碼,以及分頁
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
<div class = "right" > <a href= "$val[url]" > <div class = "list-title" > { $CAT [ 'catname' ]}</div></a> <!--列表項--> {pc:content action= "lists" catid= "$catid" order= "id DESC" num= "10" page= "$page" } {loop $data $val } <div class = "right-item" > <a href= "{$val['url']}" > <div class = "item-context" >{ $val [ 'title' ]}</div> </a> <div class = "item-time" >{ date ( 'Y-m-d H:i:s' , $val [inputtime])}</div> </div> {/loop} {/pc} <!--分頁--> <div class = "paging" > { $pages } </div> </div> |
友情鏈接的添加
1
2
3
4
5
6
7
8
|
友情鏈接: {pc:link action= "type_list" typeid= "0" siteid= "1" linktype= "1" order= "listorder DESC" num= "4" return = "pic_link" } {loop $pic_link $v } <a href= "{$v['url']}" >{ $v [ 'name' ]}</a> {/loop} {/pc} |
關于我們可以用單頁面來寫,
文章列表