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了。这时再去单页的内容管理页面,就会出现简介的字段了。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发表评论

登录后才能评论