Phpcms How to display the source in the foreground article list

Source: Internet
Author: User
Tags explode

Phpcms article source is divided into two kinds, one is added in the background source, the relevant data of this "source" is stored in the Database CopyFrom table, through the ID and News_data table related, the other is to add or edit the article directly written up, in the background, this " SOURCE "Only one name is stored in the" CopyFrom "field of the News_data table.

Phpcms the output array of the lists label is not the source field by default, in order to display, in the above two cases, to be processed separately in different ways.

1. The first case

In this case, all the relevant data of "source" is stored in the cache, can be useful after reading the GetCache function, add a copyfrom field to the return array of the lists tag, and then call in the foreground, the principle and the "Show article category in foreground" method as written yesterday.

2. The second case

This is actually relatively simple, because the "source" of the relevant data has only one name, stored in the News_data table, and this table is the table of articles (news table) schedule, so in the lists tag MoreInfo property is set to 1 can be directly with {$r [' CopyFrom ' ]} to show, but the problem is that the output of the data with a tail, that is, "Source name |

This requires a PHP string function explode processing the re-output, you need two commands:

$cc=explode(' | | ', $[' CopyFrom ')} {$cc}

It is important to note that these two commands cannot be written in one line, otherwise it will be an error.

Phpcms How to display the source in the foreground article list

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.