前言
PHPCMS大家都知道這個強大的網站管理系統,想做啥樣就做啥樣,可以毫不誇張的這麼說,市面上的網站如果是使用CMS網站系統做的,大多都是PHPCMS和DEDECMS網站。不知道PHPCMS的小夥伴,自行百度腦補。
為啥要介紹這個?
因為互聯網+時代,人人都離不開手機和電腦,離不開網絡,個人、企業都需要做網站,一般做一個網站需要前後端一起才能把網站做完,如果我只是一個web前端不懂後台,我咋做一個網站,如果我是小白,我咋開發一個適合自己的網站,這就是我們發佈此文章的目的。
PHPCMS V9模板設計常用變量
變量 全局 釋義
{CHARSET} √ 字符集
$SEO[‘title’] √ 頁面標題
$SEO[‘site_title’] √ 網站標題
$SEO[‘keyword’] √ keyword
{$SEO[‘description’] √ description
{CSS_PATH} √ css路徑
{JS_PATH} √ js路徑
{IMG_PATH} √ img路徑
{APP_PATH} √ app路徑
{get_siteid()} √ 站點ID
{$siteid} √ 分站URL
{siteurl($siteid)} √ 站點URL
{$catid} √ 欄目ID
{$pages}√ 分頁
phpcms調用最高父級欄目圖片:{$CATEGORYS[$top_parentid][image]}
phpcms調用直接父級欄目圖片:{$CATEGORYS[$parentid][image]}
phpcms調用當前欄目圖片:{$CATEGORYS[$catid][image]}
phpcms調用指定id的欄目圖片:{$CATEGORYS[78][image]}
調用模版頭部 調用模版底部
{template "content","header"}
{template "content","footer"}
首頁標籤
設為首頁
<a href=" " onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('{siteurl($siteid)}');">設為首頁</a>
加入收藏
<a href="javascript:window.external.AddFavorite('{siteurl($siteid)}','{$SEO['site_title']}')">加入收藏</a>
首頁導航導航欄
{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}
<li {if empty($catid)}class="current"{/if}><a href="{siteurl($siteid)}"><span>首頁</span></a></li>
{loop $data $r}
<li {if $r['catid'] == $catid || $top_parentid==$r['catid'] || $parentid==$r['catid']}class="current"{/if}><a href="{$r[url]}"><span>{$r[catname]}</span></a></li>
{/loop}
{/pc}
子欄目導航欄循環
<?php
if(empty($CATEGORYS[$CAT[parentid]][catid])){
$mycatId = $catid;
}else{
$mycatId = $CATEGORYS[$CAT[parentid]][catid];
}
?>
{pc:content action="category" catid="$mycatId" num="25" siteid="$siteid" order="listorder ASC"}
{loop $data $r}
<li>
<a href="{$r[url]}" {if $r['catid'] == $catid || $parentid==$r['catid']}class="current" {/if}>{$r[catname]}</a>
</li>
{/loop}
{/pc}
推薦文章單個推廣位調用
{pc:content action="position" posid="10" catid="$catid" num="20" order="id DESC" cache="3600"}
{loop $data $r}
<p class="list"><a href="{$r[url]}" title="{$r[title]}">{$r[title]}</a></p>
{/loop}
{/pc}
推薦文章 多個推廣位調用
{pc:get sql="SELECT `url`,`title` FROM `v9_dede_article` where `posids`<>0 AND `catid`=$catid ORDER BY `v9_dede_article`.`inputtime` DESC" num="15"}
{$CATEGORYS[$catid][catname]}推薦文章
<ul>
{loop $data $r}
<li class="height25 line-height25 ico_grey hidden"><a href="{$r[url]}"{if $r['style']}{title_style($r[style])}{/if}title="{$r[title]}">{$r[title]}</a></li>
{/loop}
{/pc}
首頁相關列表
圖片縮略圖 {thumb($r[thumb],200,100,1)}
{pc:content action="lists" catid="10" order="id desc" num="6"}
{loop $data $r}
<li class="tr"><a href="{$r[url]}" target="_blank" class="fl" title="{$r[title]}" alt="{$r[title]}">{str_cut($r[title],72,'')}</a><span>{date('Y-m-d', $r[inputtime])}</span></li>
{/loop}
{/pc}
當前欄目文章列表
{pc:content action="lists" catid="$catid" order="id desc」 num=""}
{loop $data $r}
<a href="{$r[url]}" target="_blank">{$r[title]}</a>
{/loop}
{/pc}
首頁熱門文章
{pc:announce action="hits" siteid="$siteid" num="2"}
{loop $data $r}
<a href="{APP_PATH}index.php?m=announce&c=index&a=show&aid={$r['aid']}">{$r['title']}</a>
{/loop}
{/pc}
首頁圖片列表
{pc:content action="position" posid="" thumb="1" order="listorder DESC" num=""}
<ul class="content news-photo picbig">
{loop $data $r}
<li>
<div class="img-wrap">
<a href="{$r[url]}" title="{$r[title]}"><img src="{thumb($r[thumb],110,0)}" title="{$r[title]}"/></a>
</div>
<a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],20)}</a>
</li>
{/loop}
</ul>
{/pc}
首頁友情鏈接
友情鏈接:
<a href="{APP_PATH}index.php?m=link&c=index&a=register&siteid={$siteid}">申請鏈接</a>
{pc:link action="type_list" siteid="$siteid" order="listorder DESC" num="10" return="dat"}
{loop $dat $v}
{if $type==0}
<a href="{$v[url]}" target="_blank">{$v[name]}</a> |
{else}
<a href="{$v[url]}" target="_blank"><img src="{$v[logo]}" width="88" height="31" style="border: 1px solid #FFBE7A;"></a>
{/if}
{/loop}
{/pc}
{pc:link action="type_list" siteid="$siteid" typeid=「53」 linktype="0" order="listorder DESC" num="8" return="pic_link"}
{loop $pic_link $v}
<a href="{$v['url']}" title="{$v['name']}" target="_blank"><img src="{$v[logo]}" width="88" height="31" /></a>
{/loop}
{/pc}
注意 linktype如0代表文字鏈接 如果為1代表圖片鏈接
首頁URL:{siteurl($siteid)}
列表頁標籤
{pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
{loop $data $r}
<li class="tr"><a href="{$r[url]}" title="{$r[title]}" alt="{$r[title]}" class="fl">{$r[title]}</a> <span>{date('Y-m-d H:i:s',$r[inputtime])}</span></li>
{/loop}
{/pc}
- 分頁標籤:{$pages}
- 日期:{date(‘Y-m-d’, $r[updatetime])}
- 標題截斷:{str_cut($r[title],40,’…’)} 調用字段控制:使用截斷代碼:截斷標題:{str_cut($r[title],36,’…’)}
- 文章簡介:{$r[‘description’]}
- 縮略圖 {thumb($r[thumb], 100, 137, 1)}
- pc循環的時候 序號為 {$n} 記住這個很實用,特別是在條件判斷的時候
內容頁面標籤
- 網站首頁—————-{siteurl($siteid)}
- 當前位置—————-{catpos($catid)}
- 當前欄目ID————–{$CAT[catid]}
- 當前欄目鏈接————{$CAT[url]}
- 當前欄目名稱————{$CAT[catname]}
- 欄目拼音—————-{$CAT[letter]}
- 欄目鏈接—————-{$CAT[url]}
- 父欄目ID————– {$CATEGORYS[$CAT[parentid]][catid]}
- 父欄目名稱————–{$CATEGORYS[$CAT[parentid]][catname]}
- 父欄目鏈接————–{$CATEGORYS[$CAT[parentid]][url]}
- 上上級欄目名稱——–{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][catname]}
- 上上級欄目鏈接——–{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][url]}
- 文章標題:{$title}
- 文章內容:{$content}
- 發佈日期:{$inputtime} 自定義日期格式方法{date(‘Y-m-d H:i:s’, strtotime($inputtime))}
- 文章來源:{$copyfrom}
- 點擊量:<a id=”hits” href=”javascript:”><script language=”JavaScript” src=”{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}”></script></a>
- 當前位置:<a href=”{siteurl($siteid)}”>首頁</a><span> > </span>{catpos($catid)}{$title}
- 當前欄目:<a href=”{$CAT[url]}”>{$CAT[catname]}</a>
- 上一篇:<a href=”{$previous_page[url]}”>{$previous_page[title]}</a>
- 下一篇:<a href=”{$next_page[url]}”>{$next_page[title]}</a>
- 縮略圖 : {thumb($thumb,352,264,1)}
PHPCMS PC標籤擴展分頁的方法 適合單頁面/專題頁面的數據調出
{pc:content action="lists" catid="2" order="id DESC" num="4" page="$page" }
{$pages}
{/pc}
PHPCMS V9單頁面新增字段的方法
phpcms v9的單頁面功能比較簡單,有時不能滿足我們的需求,例如新增一個字段,來添加信息,怎麼辦?其實很簡單,只要照下面兩步操作就可以達到我們的目的。
第一步:v9_page數據表添加一個description字段,字段類型為varchar,長度255。(利用mysql的phpmyadmin管理界面操作比較簡單)
第二步:修改phpcms\modules\content\templates\content_page.tpl.php
找到
<tr><th width="80"> <?php echo L('content');?></th><td>
上方添加:
<tr><th width="80">內容簡介</th>
<td><textarea type="text" name="info[description]" style='width:98%;height:46px;'><?php echo $description?></textarea>只可輸入<B><span id="description_len">255</span></B> 個字符</td>
</tr>
保存文件,更新系統緩存就OK了。這時再去單頁的內容管理頁面,就會出現簡介的字段了。
原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/274268.html
微信掃一掃
支付寶掃一掃