Home> CMS Tutorial> PHPCMS> body text

How to use phpcms tag?

coldplay.xixi
Release: 2020-07-14 13:20:11
Original
2920 people have browsed it

Usage of phpcms tag: 1. Display the column name and link of the specified catid; 2. Call the sub-column; 3. Get the news under the specified column; 4. Implement the paging function.

How to use phpcms tag?

Usage of phpcms tag:

1. Display the column name and link of the specified catid{$CATEGORYS[25]['catname']} {$CATEGORYS[25]['url']}

Get the parent column id, get the parent column name$CATEGORY[$catid][ parentid]}Parent column name:{$CATEGORYS[$CAT[parentid]][catname]}

The ellipsis that appears after removing the title restriction

{str_cut($r[title],36,'...')}
Copy after login

Formatting time 2011-05-06 11:22:33

{date('Y-m-d H:i:s',$r[inputtime])} {date('Y年m月d日',$r[inputtime])}
Copy after login

2. Call sub-column(need to be used in the column homepage template, and can also be used in the list page)

{pc:content action="category" catid="$catid" num="25" siteid="$siteid" order="listorder ASC"} {loop $data $r} {$r[catname]} | {/loop}{/pc}
Copy after login

3. Get the news under the specified column

(1) Here moreinfo="1" means that the main and secondary tables can be related directly using

{pc:content action="lists" catid="$catid" num="25" order="id DESC" return="info" moreinfo="1"} {loop $info $r} 更新日期:{date('Y年m月d日',$r[updatetime])} 作者:{$r[username]} 来源:{$r[copyfrom]} 点击率{$r[readpoint]} 网址{$r[url]} 文章标题 {$r['title']} 标题样式{title_style($v[style])} {/loop} {/pc} 

=====================

Copy after login

( 2) The sql universal statement can call the specified content more conveniently

{pc:get sql="select * from v9_news as a,v9_news_data as b where a.id=b.id and catid=34 and status=99 order by a.id desc"} {loop $data $v} 
  • {/loop} {/pc} {pc:get sql="select * from v9_news where catid=10 and status=99 order by updatetime desc" num="5" start="23"} {loop $data $rs} {$rs['title']} {/loop} {/pc}

    =====================

    Copy after login

    (3) The article is called from the specified position (position is recommended)

    The starting position is 5, and 3 articles are called. Equivalent to the limit function.

    {pc:content action="position" posid="27" order="listorder DESC" num="3" start="5"} {loop $info $r} {str_cut($r[description],115)}...  {/loop} {/pc} 或{pc:content action="lists" catid="54" thumb="" order="listorder DESC" start="3" num="5"} thumb="" 不分类 

    =====================

    循环列表新闻
    {pc:content action="position" posid="9" order="listorder DESC" num="4"} {loop $data $r} {str_cut($r[title],36,'')}{date('Y-m-d H:i:s',$r[inputtime])}

    {if $n==1}{/if}{str_cut($r[description],112,'')}[reading more]

    {/loop} {/pc}

    =====================

    Copy after login

    (4) There is a paging effect

    {pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"} 
    {$pages}
    {/pc}
    Copy after login
    Copy after login

    4.

    {pc:content action="position" posid="1" order="listorder DESC" thumb="1" num="5"} {loop $data $r} {$r['title']} {/loop} {/pc}
    Copy after login

    5. Paging

    The front desk call num="50" refers to 50 records per page

    {pc:get sql="select * from wecheweyounews where hour=$hour order by id desc" return="data" num="50" page="$page"} 
    {$pages}
    {/pc}
    Copy after login
    Copy after login

    Related learning recommendations :phpcms tutorial

    The above is the detailed content of How to use phpcms tag?. For more information, please follow other related articles on the PHP Chinese website!

    Related labels:
    source:php.cn
    Previous article:Where to set up the database in phpcms Next article:What are the steps to build phpcms?
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Articles by Author
    Latest Issues
    Related Topics
    More>
    Popular Recommendations
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!