phpcms基本语句的用法

2021-07-11 04:05

阅读:680

标签:menu   程序   lists   head   time   ==   blog   span   content   

最近在做企业站,这里将phpcms里的常用语句总结一下:

1、头部:

"Content-Type" content="text/html; charset={CHARSET}" />

{<span>if</span> isset($SEO[<span>‘</span><span>title</span><span>‘</span>]) && !empty($SEO[<span>‘</span><span>title</span><span>‘</span>])}{$SEO[<span>‘</span><span>title</span><span>‘</span>]}{/<span>if</span>}{$SEO[<span>‘</span><span>site_title</span><span>‘</span>]}"keywords" content="{$SEO[‘keyword‘]}">

"description" content="{$SEO[‘description‘]}">

2、常用系统常量: {CSS_PATH} {JS_PATH} {IMG_PATH} {APP_PATH}//程序目录

3、头尾替换:

{template "content","header"}

{template "content","footer"}

4、常用调用数据:

{pc:content action="lists" catid="6" num="8" order="inputtime DESC" }

{loop $data $r}

  • class="date">({date(Y/m/d H:m:s,$r[inputtime])})"{$r[url]}" target="_blank" title="{$r[title]}">{str_cut($r[title],28)}
  • {/loop} {/pc}

    5、推荐位调用:

    {pc:content action="position" posid="1" order="listorder DESC" num="5"}
    
    {loop $data $r}
    
    
  • "{$r[url]}" target="_blank">"{$r[thumb]}" text="{$r[title]}" alt="{$r[title]}" width="727" height=243 />
  • {/loop} {/pc}

    6、一级栏目调用:

    {pc:content action="category" catid="0" num="8" siteid="$siteid" order="listorder ASC"}
    
    {loop $data $r}
    
    
  • "{$r[url]}" title="{$r[catname]}">{$r[catname]}
  • {/loop} {/pc}

    7、文章列表页调用关键字,或者首页调用关键字::

    {pc:content action="lists" catid="$catid" num="10" order="id DESC" page="$page"}
    
    {loop $data $r}
    
    "{$r[url]}">{$r[title]}
    
    php $keywords = explode(,,$r[keywords]);}
    
    文章标签:
    
    {loop $keywords $keyword}
    
    "{APP_PATH}index.php?m=content&c=tag&catid={$catid}&tag={urlencode($keyword)}" class="blue"> {$keyword}
    
    {/loop}
    
    {/loop}
    
    {/pc}

    8、判断是否为首页:

    {if $top_parentid==0}
    //首页地址
    "{siteurl($siteid)}">
    class="menu menu_sel">首页
    {else}
    "{siteurl($siteid)}">
    class="menu">首页
    {/if}

    9、取浏览数:

    span id="hits">
    

    10、友情链接:

    {pc:link action="type_list" typeid="0" siteid="1" linktype="1" order="listorder DESC" num="8"}
    
    {loop $data $v}
    
    "{$v[‘url‘]}" title="{$v[‘name‘]}" target="_blank">{$v[name]}
    
    {/loop}
    
    {/pc}

    11、调用单页内容:

    pc:get sql="SELECT content FROM v9_page where catid=‘6‘" return="data"}
    
    {loop $data $r}
    
    {str_cut(strip_tags($r[content]), 160)}
    
    {/loop}
    
    {/pc}

    12、显示上一页和下一页:

    上一篇:"{$previous_page[url]}">{$previous_page[title]}
    下一篇:
    "{$next_page[url]}">{$next_page[title]}

     

    phpcms基本语句的用法

    标签:menu   程序   lists   head   time   ==   blog   span   content   

    原文地址:http://www.cnblogs.com/mengshenshenchu/p/7088152.html


    评论


    亲,登录后才可以留言!