PHPCMS独家原创笔记,10分钟做一个企业站

前言

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"}

首页标签

设为首页


加入收藏


首页导航导航栏

{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}

  • {loop $data $r}

  • {/loop}
    {/pc}

    子栏目导航栏循环

    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}



  • {/loop}
    {/pc}

    推荐文章单个推广位调用

    {pc:content action="position" posid="10" catid="$catid" num="20" order="id DESC" cache="3600"}
    {loop $data $r}
    \t


    {/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]}推荐文章


      {loop $data $r}
      \t
    {pc:content action="lists" catid="10" order="id desc" num="6"}
    {loop $data $r}
    \t
  • {date('Y-m-d', $r[inputtime])}

  • {/loop}
    {/pc}

    当前栏目文章列表

    {pc:content action="lists" catid="$catid" order="id desc” num=""}
    {loop $data $r}

    {/loop}
    {/pc}

    首页热门文章

    {pc:announce action="hits" siteid="$siteid" num="2"}
    {loop $data $r}

    {/loop}
    {/pc}

    首页图片列表

    {pc:content action="position" posid="" thumb="1" order="listorder DESC" num=""}

      {loop $data $r}






    • {/loop}

    {/pc}

    首页友情链接

    友情链接:


    {pc:link action="type_list" siteid="$siteid" order="listorder DESC" num="10" return="dat"}
    {loop $dat $v}
    {if $type==0}
    |
    {else}

    {/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}

    {/loop}
    {/pc}

    注意 linktype如0代表文字链接 如果为1代表图片链接

    首页URL:{siteurl($siteid)}

    列表页标签


    {pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
    \t{loop $data $r}
    \t
  • {date('Y-m-d H:i:s',$r[inputtime])}

  • \t{/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. 点击量:
    18. 当前位置: > {catpos($catid)}{$title}
    19. 当前栏目:
    20. 上一篇:
    21. 下一篇:
    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

    找到

    上方添加:
    内容简介
    <textarea>/<textarea>只可输入255 个字符


    保存文件,更新系统缓存就OK了。这时再去单页的内容管理页面,就会出现简介的字段了。


    分享到:


    相關文章: