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.
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,'...')}
Formatting time 2011-05-06 11:22:33
{date('Y-m-d H:i:s',$r[inputtime])} {date('Y年m月d日',$r[inputtime])}
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} <a href="{$r[url]}">{$r[catname]}</a> | {/loop}{/pc}
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} <p>=====================</p
( 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} <li><a href="{$v['url']}" target="_blank"><img src="/static/imghwm/default1.png" data-src="{$v[thumb]}" class="lazy" style="max-width:90%" style="max-width:90%" / alt="How to use phpcms tag?" ></a></li> {/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} <a href="{$rs['url']}" title="{$rs['title']}" target="_blank">{$rs['title']}</a> {/loop} {/pc} <p>=====================</p
(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} <a href='{$r[url]}'>{str_cut($r[description],115)}... </a> {/loop} {/pc} 或{pc:content action="lists" catid="54" thumb="" order="listorder DESC" start="3" num="5"} thumb="" 不分类 <p>=====================</p>循环列表新闻 <div class="content"> {pc:content action="position" posid="9" order="listorder DESC" num="4"} {loop $data $r} <a href="{$r[url]}" title="{$r[title]}">{str_cut($r[title],36,'')}</a>{date('Y-m-d H:i:s',$r[inputtime])} <p>{if $n==1}<img src="/static/imghwm/default1.png" data-src="{thumb($r[thumb],90,60)}" class="lazy" style="max-width:90%" style="max-width:90%"/ alt="How to use phpcms tag?" >{/if}{str_cut($r[description],112,'')}<a href="{$r[url]}">[reading more]</a></p> {/loop} {/pc} </div> <p>=====================</p>
(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"} <ul > {loop $data $r} <li><span class="left">·<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li> <?php if($n%5==0 and $n<50) echo "</ul><ul>"; ?> {/loop} </ul> </div> <div id="pages" class="text-c">{$pages}</div> {/pc}
4.
{pc:content action="position" posid="1" order="listorder DESC" thumb="1" num="5"} {loop $data $r} <a href="{$r['url']}" title="{str_cut($r['title'],30)}"><img src="/static/imghwm/default1.png" data-src="{thumb($r['thumb'],300,200)}" class="lazy" alt="{$r['title']}" style="max-width:90%" style="max-width:90%" /></a> {/loop} {/pc}
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"} <ul > {loop $data $r} <li><span class="left">·<a href="{$r['url']}" target="_blank">{str_cut($r['title'],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r['inputtime'])}</span></li></li> <?php if($n%5==0 and $n<50) echo "</ul><ul>"; ?> {/loop} </ul> </div> <div id="pages" class="text-c">{$pages}</div> {/pc}
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

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),

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.