Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Phpcms calls the method of the content

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the method of calling the content of phpcms, which is very detailed and has a certain reference value. Interested friends must read it!

How does phpcms call content?

How to call the content of the article on the inside page of the phpcms homepage

In fact, there are many ways to use phpcms to call the content of a single article on the home list page. We can copy the content directly instead of using the program to call it automatically. But how to repeatedly operate more, there will be a certain amount of locking. In addition, we can list the label {pc:content} for automatic invocation.

To introduce you to the two implementation methods.

An Analysis of the idea of calling the content of the articles on the inside Page of the Home Page

Reminder: the moreinfo parameter attribute is supported since version 20101105 of PHPCMS V9 Beta. This parameter means that when the data is returned, the data in the secondary table will be returned as well. A content model is divided into two tables, a primary table and a secondary table. The main table generally stores short data such as headings, columns and so on (convenient for indexing), while the secondary table stores data with large fields, such as content. When you create a new field in model management, it allows you to choose whether to store it in the primary or secondary table (we recommend that you put unimportant information in the secondary table).

If you want to retrieve data from a secondary table in a list, you need to use the moreinfo attribute in the PC tag. But we only call a fixed article on the home page, not a lot of it, which is acceptable for performance. Here are two ways to implement it.

Implement the method of invoking the content of a single article

Method 1:

Using the {pc:content action= "lists"} basic tag, you can implement a list that invokes content for each list item. If you only call the content of an article, change num= "4" to num= "1". The called article is in the first or last article, which is adjusted by order= "id DESC" or order= "id".

{pc:content action= "lists" catid= "6" order= "id DESC" num= "4" moreinfo= "1"} {loop $data $key $val} {$val ['title']} {$val [' content']} {/ loop} {/ pc}

Method 2:

Using the extended {pc:content action= "lists"} tag, you can call the inner page article content of the specified article ID. You need to use the where attribute to specify the article ID value of the call. This implementation is more flexible, but slightly more complex than the first.

{pc:content action= "lists" catid= "6" where= "`id` = 3" num= "1" moreinfo= "1"} {loop $data $key $val} {$val ['title']} {$val [' content']} {/ loop} {/ pc} is all the contents of the phpcms call method, thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report