<menu id="ycqsw"></menu><nav id="ycqsw"><code id="ycqsw"></code></nav>
<dd id="ycqsw"><menu id="ycqsw"></menu></dd>
  • <nav id="ycqsw"></nav>
    <menu id="ycqsw"><strong id="ycqsw"></strong></menu>
    <xmp id="ycqsw"><nav id="ycqsw"></nav>
  • phpcms多種模型(php網站管理系統操作)


    前言

    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}
    
    1. 分頁標簽:{$pages}
    2. 日期:{date(‘Y-m-d’, $r[updatetime])}
    3. 標題截斷:{str_cut($r[title],40,’…’)} 調用字段控制:使用截斷代碼:截斷標題:{str_cut($r[title],36,’…’)}
    4. 文章簡介:{$r[‘description’]}
    5. 縮略圖 {thumb($r[thumb], 100, 137, 1)}
    6. pc循環的時候 序號為 {$n} 記住這個很實用,特別是在條件判斷的時候

    內容頁面標簽

    1. 網站首頁—————-{siteurl($siteid)}
    2. 當前位置—————-{catpos($catid)}
    3. 當前欄目ID————–{$CAT[catid]}
    4. 當前欄目鏈接————{$CAT[url]}
    5. 當前欄目名稱————{$CAT[catname]}
    6. 欄目拼音—————-{$CAT[letter]}
    7. 欄目鏈接—————-{$CAT[url]}
    8. 父欄目ID————– {$CATEGORYS[$CAT[parentid]][catid]}
    9. 父欄目名稱————–{$CATEGORYS[$CAT[parentid]][catname]}
    10. 父欄目鏈接————–{$CATEGORYS[$CAT[parentid]][url]}
    11. 上上級欄目名稱——–{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][catname]}
    12. 上上級欄目鏈接——–{$CATEGORYS[$CATEGORYS[$CAT[parentid]][parentid]][url]}
    13. 文章標題:{$title}
    14. 文章內容:{$content}
    15. 發布日期:{$inputtime} 自定義日期格式方法{date(‘Y-m-d H:i:s’, strtotime($inputtime))}
    16. 文章來源:{$copyfrom}
    17. 點擊量:<a id=”hits” href=”javascript:”><script language=”JavaScript” src=”{APP_PATH}api.php?op=count&id={$id}&modelid={$modelid}”></script></a>
    18. 當前位置:<a href=”{siteurl($siteid)}”>首頁</a><span> > </span>{catpos($catid)}{$title}
    19. 當前欄目:<a href=”{$CAT[url]}”>{$CAT[catname]}</a>
    20. 上一篇:<a href=”{$previous_page[url]}”>{$previous_page[title]}</a>
    21. 下一篇:<a href=”{$next_page[url]}”>{$next_page[title]}</a>
    22. 縮略圖 : {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了。這時再去單頁的內容管理頁面,就會出現簡介的字段了。

    版權聲明:本文內容由互聯網用戶自發貢獻,該文觀點僅代表作者本人。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如發現本站有涉嫌抄襲侵權/違法違規的內容, 請發送郵件至 舉報,一經查實,本站將立刻刪除。

    發表評論

    登錄后才能評論
    国产精品区一区二区免费