search
HomeCMS TutorialPHPCMSRecommended PHPCMS guide

Recommended PHPCMS guide

Dec 22, 2020 pm 05:28 PM
phpcms

PHPCMS usage tutorialThe column introduces frequently used syntax

Recommended PHPCMS guide

Recommended (free) :PHPCMS usage tutorial

Comment call:

{php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$v[catid].'-'.$v[id].'-'.$modelid));}

comment: {if $comment_total}{$comment_total}{else}0{/if}

Recommended position call:

{pc:content action="position" posid="2"  moreinfo="1" catid="$catid" order="listorder DESC" num="1"}
{loop $data $r}
{/loop}
{/pc}

Click call:

<script></script>

List page call:

{php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[views]; }
{$views}

Content page call:

hit:<script></script>

Total number of judgments:

{if $n==count($dat)}class="friendly-border" {/if}

News previous article next article display

<span>上一篇:<a>{$previous_page[title]}</a></span>
<span>下一篇:<a>{$next_page[title]}</a></span>

Phpcms grouping

array_chunk($data(数组),10(每组有几个数))

<p>
    {pc:content action="lists" moreinfo="1" catid="17" num="20" order="id ASC"}
    {php $da=array_chunk($data,4(每组显示几个));}
        {loop $da $d}
        </p><p>
          {php $i=1;}
            {loop $d $r}
            </p><p>
                <a>
                ![]({$r[thumb]})
                <p>{$r[title]}</p>
                </a>
            </p>
            {php $i++;}
            {/loop}
        
        {/loop}
        {/pc}
        
    

//Intercept the number of words

{str_cut($r[description],102,'...')} 

{str_cut(strip_tags($r[content]),300,"...")}  //截取文字  strip_tags() 函数剥去字符串中的 HTML、XML 以及 PHP 的标签。

Add to favorites and set the homepage

<a>加入收藏</a>
<a>设为首页</a>

Add anchor

{$r[url]}#n{$r[id]}  {$rs[url]}area{$n}

Time difference

{php $now = strtotime("now")}
{date('d',$now-$r[inputtime])}天前

Get the current column

{php $arrid=$r[catid]}   {$CATEGORYS[$arrid][catname]}

Get the parent column of the current column

{$CATEGORYS[$CATEGORYS[$arrid][parentid]][catname]}

Current position call:

{catpos($catid)}

phpcms starts calling from the specified number

{pc:content action="lists" catid="10" order="id DESC LIMIT 1,4--" num="4"}
//这样就可以从第二条开始调用数据。



其中的order="id DESC LIMIT 1,4--"里的两个数字,第1个数字1表示从第2条开始调用,第2个数字4表示共调用4条。

如果改成order="id DESC LIMIT 0,4--"那么就表示从第1条开始调用,共调用4条。

如果改成order="id DESC LIMIT 2,4--"那么就表示从第3条开始调用,共调用4条。


栏目指定第几个显示(phpcms从指定第几条开始调用 )
1--->      从第二个开始显示
{php $data = array_slice($data,1);}


     {pc:content action="category" catid="$catid" num="5" siteid="$siteid" order="listorder ASC,id ASC"}
    {php $data = array_slice($data,1);}
        {loop $data $r}
             {if $cat==$catid}
            <span>{$r[catname]}</span>
             {else}
            <span>{$r[catname]}</span>                        {/if}
             {/loop}
        {/pc}

Return to the previous level

{$CATEGORYS[$catid][url]}
<a>返回上一级</a>

Related articles

{pc:content action="relation" relation="$relation" catid="$catid" num="5" keywords="$rs[keywords]"}
{loop $data $r}
  • ·{$r[title]}({date('Y-m-d',$r[inputtime])})
  • {/loop} {/pc}

    Calling multiple pictures

    {loop string2array($r['pics'])  $v}

    Calling ads

    {php $banner=getads(11);$i=1;}
        
              {loop $banner[d] $v}         {if $i        {/if}        {php $i++;}        {/loop}          

    Calling friendly links

    图片链接:
    {pc:link action="lists" typeid="0" siteid="$siteid" linktype="1" order="desc" num="6" return="dat"}
        {loop $dat $v}
         <a>![]({$v[logo]})</a>
         {/loop}
    {/pc}
    文字链接:
    {pc:link action="lists" typeid="0" siteid="$siteid" linktype="0" order="desc" num="10" return="dat"}
        {loop $dat $v}
                 <a>{$v[name]} </a>
            {/loop}
    {/pc}

    Judge whether the array contains a certain number

    if(in_array("29",$xmlx)){
        //array_push($xmlx,$qt);
        $qt=$_POST['qita'];
    }

    Column page calling source:

    {php list($copyfrom) = explode('|', $r['copyfrom'])}  {$copyfrom}

    Call verification code:

    前台
    {php pc_base::load_sys_class('form', '', 0);$setting = getcache('formguide', 'commons');} 
    {form::checkcode('code_img', '4', 90, 30)}
     {form::checkcode('code_img','4','14',110,30)}
    后台开始session配置
    //启动session
    $session_storage = 'session_'.pc_base::load_config('system','session_storage');
    pc_base::load_sys_class($session_storage);

    Mysql search how to determine whether a field contains a certain string

    利用mysql 字符串函数 find_in_set();
    
    SELECT * FROM users WHERE find_in_set('aa@email.com', emails);

    Calling the model drop-down box

    {php $ks=filtersele('dertment',12);}

    Path jump (without a tag):

    <script>
        function urls(obj){
        var url = $(obj).attr(&#39;data-url&#39;);
        window.location.href = url;
    }
    </script>
    <span>返回</span>

    Jump to the home page

    {siteurl($siteid)}

    Column picture call

    {$CATEGORYS[$catid][image]}

    Mobile site previous articleNext article

    PHP源码修改:
    打开 phpcms\modules\wap\index.php 文件
    找到
    if(!$r || $r['status'] != 99) showmessage(L('info_does_not_exists'),'blank');
    在其下面添加
    //上一篇
    $previous_page = $this->db->get_one("`catid` = '$catid' AND `id`db->get_one("`catid`= '$catid' AND `id`>'$id' AND `status`=99");
    //当前页为第一篇时:再点击上一篇仍然显示第一篇
    if(empty($previous_page)) {
    $previous_page = $this->db->get_one("`catid` = '$catid' AND `id`='$id' AND `status`=99",'*','id DESC');
    }
    //当前页为最后一篇时:再点击下一篇仍然显示最后一篇
    if(empty($next_page)) {
    $next_page = $this->db->get_one("`catid`= '$catid' AND `id`='$id' AND `status`=99");
    }
    
    调用:
     <a>上一条:{$previous_page[title]}</a>            
    <a>下一条: {$next_page[title]}</a>

    Mobile site call Column picture

    {$TYPE[$typeid][image]}

    Column secondary display

    {pc:content action="category" catid="0" order="listorder DESC" siteid="$siteid" num="7"}
            {loop $data $r}
                
  •                 {$r[catname]}                     

                        {pc:content action="category" catid="$r[catid]" num="8" siteid="$siteid" order="listorder DESC" return="dat"}                     {loop $dat $v}                         {$v[catname]}                     {/loop}                     {/pc}                     

                
  •         {/loop}         {/pc}

    Download model

            {pc:content action="lists" catid="$catid" num="15" order="id DESC" page="$page" moreinfo="1"}
            {loop $data $r}
                {php $xiazai = string2array($r['downfiles']);}
                {loop $xiazai $b}
                    
                        
                                                         {$r[title]}                                                  [{date('Y-m H:i',$r[inputtime])}]                     
                        
                            {str_cut(strip_tags($r[content]),340)}                     
                    
                                 {/loop}         {/loop}         {/pc}

    Judge odd and even numbers

    {$n}.{if $n%2==0}偶数{else}奇数{/if}   <br>

    The above is the detailed content of Recommended PHPCMS guide. For more information, please follow other related articles on the PHP Chinese website!

    Statement
    This article is reproduced at:简书. If there is any infringement, please contact admin@php.cn delete

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Tools

    mPDF

    mPDF

    mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

    VSCode Windows 64-bit Download

    VSCode Windows 64-bit Download

    A free and powerful IDE editor launched by Microsoft

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function

    MantisBT

    MantisBT

    Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use