Home CMS Tutorial PHPCMS How to use phpcms tag?

How to use phpcms tag?

Jul 14, 2020 pm 01:20 PM
phpcms Label

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}
        <a href="{$r[url]}">{$r[catname]}</a> |
   {/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(&#39;Y年m月d日&#39;,$r[updatetime])}
             作者:{$r[username]}
             来源:{$r[copyfrom]}
             点击率{$r[readpoint]}
             网址{$r[url]}
             文章标题 {$r[&#39;title&#39;]}
             标题样式{title_style($v[style])}
                      
    {/loop}
    {/pc}
<p>=====================</p
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} 
  <li><a href="{$v[&#39;url&#39;]}" target="_blank"><img src="{$v[thumb]}" width="146" height="117" /></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[&#39;url&#39;]}" title="{$rs[&#39;title&#39;]}" target="_blank">{$rs[&#39;title&#39;]}</a>
     {/loop}
 {/pc}
<p>=====================</p
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}
                <a  href=&#39;{$r[url]}&#39;>{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,&#39;&#39;)}</a>{date(&#39;Y-m-d H:i:s&#39;,$r[inputtime])}
                <p>{if $n==1}<img src="{thumb($r[thumb],90,60)}" width="90" height="60"/>{/if}{str_cut($r[description],112,&#39;&#39;)}<a href="{$r[url]}">[reading more]</a></p>
               
               {/loop} 
             {/pc}  
            </div>
<p>=====================</p>
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"}
                <ul >
        {loop $data $r}
                    <li><span class="left">&middot;<a href="{$r[&#39;url&#39;]}" target="_blank">{str_cut($r[&#39;title&#39;],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r[&#39;inputtime&#39;])}</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}
Copy after login
Copy after login

4.

{pc:content  action="position" posid="1"  order="listorder DESC" thumb="1" num="5"}
 {loop $data $r}
  <a href="{$r[&#39;url&#39;]}" title="{str_cut($r[&#39;title&#39;],30)}"><img src="{thumb($r[&#39;thumb&#39;],300,200)}" alt="{$r[&#39;title&#39;]}" width="310" height="260" /></a>
    {/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"}
                <ul >
        {loop $data $r}
                    <li><span class="left">&middot;<a href="{$r[&#39;url&#39;]}" target="_blank">{str_cut($r[&#39;title&#39;],60)}</a>(编辑:{$r[username]})</span><span class="right">{date("Y-m-d",$r[&#39;inputtime&#39;])}</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}
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!

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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to search for text across all tabs in Chrome and Edge How to search for text across all tabs in Chrome and Edge Feb 19, 2024 am 11:30 AM

This tutorial shows you how to find specific text or phrases on all open tabs in Chrome or Edge on Windows. Is there a way to do a text search on all open tabs in Chrome? Yes, you can use a free external web extension in Chrome to perform text searches on all open tabs without having to switch tabs manually. Some extensions like TabSearch and Ctrl-FPlus can help you achieve this easily. How to search text across all tabs in Google Chrome? Ctrl-FPlus is a free extension that makes it easy for users to search for a specific word, phrase or text across all tabs of their browser window. This expansion

How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? How to add tags on Douyin to attract traffic? Which tags on the platform are easiest to attract traffic to? Mar 22, 2024 am 10:28 AM

As a popular short video social platform, Douyin has a huge user base. For Douyin creators, using tags to attract traffic is an effective way to increase the exposure of content and attract attention. So, how does Douyin use tags to attract traffic? This article will answer this question in detail for you and introduce related techniques. 1. How to add tags on Douyin to attract traffic? When posting a video, make sure to choose tags that are relevant to the content. These tags should cover the topic and keywords of your video to make it easier for users to find your video through tags. Leveraging popular hashtags is an effective way to increase your video’s exposure. Research current popular tags and trends and incorporate them into your video descriptions and tags. These popular tags usually have higher visibility and can attract the attention of more viewers. 3. Label

What is the clock behind the TikTok label? How to tag Douyin account? What is the clock behind the TikTok label? How to tag Douyin account? Mar 24, 2024 pm 03:46 PM

When browsing Douyin works, we often see a clock icon behind the tag. So, what exactly is this clock? This article will focus on the discussion of &quot;What is the clock behind the Douyin label&quot;, hoping to provide some useful reference for your use of Douyin. 1. What is the clock behind the Douyin label? Douyin will launch some hot topic challenges. When users participate, they will see a clock icon after the tag, which means that the work is participating in the topic challenge and displays the remaining time of the challenge. For some time-sensitive content, such as holidays, special events, etc., Douyin will attach a clock icon after the label to remind users of the validity period of the content. 3. Popular tags: When a tag becomes popular, Douyin will add a clock icon after the tag to indicate that the tag is

How to jump to the details page in phpcms How to jump to the details page in phpcms Jul 27, 2023 pm 05:23 PM

How to jump to the details page in phpcms: 1. Use the header function to generate a jump link; 2. Loop through the content list; 3. Get the title and details page link of the content; 4. Generate a jump link.

A closer look at the video element in HTML A closer look at the video element in HTML Feb 24, 2024 pm 08:18 PM

Detailed explanation of the video tag in HTML The video tag in HTML5 is a tag used to play videos on web pages. It can render videos using different formats, such as MP4, WebM, Ogg, and more. In this article, we will introduce the use of video tag in detail and provide specific code examples. Basic Structure The following is the basic structure of the video tag:

What is the difference between html5 tag head and header? What is the difference between html5 tag head and header? Jan 17, 2022 am 11:10 AM

Differences: 1. The head tag is used to define the head of the document, which is a container for all head elements, and the header tag is used to define the header (introduction information) of the document; 2. All browsers support the head tag, and older versions of browsers None of the browsers support the header tag, and browsers such as IE9+ and above are required to support the header tag.

What framework is phpcms? What framework is phpcms? Apr 20, 2024 pm 10:51 PM

PHP CMS is a PHP-based open source content management system for managing website content. Its features include ease of use, powerful functionality, scalability, high security, and free open source. It can save time, improve website quality, enhance collaboration and reduce development costs, and is widely used in various websites such as news websites, blogs, corporate websites, e-commerce websites and community forums.

How to delete external contact tags on DingTalk app How to delete external contact tags on DingTalk app Feb 24, 2024 am 08:20 AM

How to delete external contact tags on DingTalk app? DingTalk has a function to delete external contact tags, but most friends don’t know how to delete external contact tags on DingTalk. Next is the DingTalk guide that the editor brings to users. Graphical tutorial on how to delete external contact tags in the Ding app. Interested users can come and take a look! How to delete external contact tags in DingTalk app 1. First open DingTalk APP and click the [Management] function as shown below on the main page; 2. Then enter the enterprise management interface and find [External Contacts]; 3. Then on the external contact setting function page, select the [Label Management] service; 4. Then on the main contact label page, select the type of label group you want to delete; 5. Finally, click on the red label group

See all articles