Phpcms V9 using get invoke to specify ID article content, page data method

Source: Internet
Author: User

I wonder if you have the same experience? When using Phpcms V9 to build a station call data, the underlying data with the default template of the invocation of the statement is good, but how to call complex and uncommon data? Our technology may be studied for half a day, with the spirit of exploration constantly trying and tireless. Here, Cmsyou will be in the process of actually customizing the template to the customer encountered and discussed some of the way out of the call with you!

One, use get call phpcms V9 Specify ID page data method


Copy the Code code as follows:
{pc:get sql= "select * from Cmsyou_page WHERE catid= '" cache= "3600" return= "Data"}
{Loop $data $val}
{$val [content]}
{/loop}
{/PC}

NOTE: Notice the modification of the data table prefix, the current we think of the article is written by default "Cmsyou_", where catid= ' 55 ' "means to specify the invocation ID 55 of the single page content.

Second, you can extrapolate, call the specified ID article content.

Hint: Reference 1th, at the same time can use phpMyAdmin this kind of database management software, see PHPCMS V9 data table is how. Location hints for the data of the article:


Copy the Code code as follows:
Article Model: Cmsyou_news
Picture model: Cmsyou_picture
Download Model: Cmsyou_download
Video model: Cmsyou_video

At the same time the data of the main table and the sub-table, above said is only the main table, in this, we can comment comments, mutual discussion!

Third, broader extension: Call the nickname of the specified user name, how to do?

Question: I want to bring up the nickname of the Publisher (Administrator or contributor) in the Content Show page, how can I call out the class?

Workaround:


Copy the Code code as follows:
<span class= "Otherspan" > Source:
{pc:get sql= "select * from Cmsyou_member WHERE username= ' $username '" cache= "3600" return= "Data"}
{Loop $data $val}
{$val [nickname]}
{/loop}
{/PC}
</span>

Note: The above code uses get to fetch data from the member table, and sets the calling condition of where username= ' $username ', calling the nickname of the current user name.

After looking at the above three, have you found something? The Get statement is very powerful, can you invoke the search data? Waiting for your discovery!

Phpcms V9 using get invoke to specify ID article content, page data method

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.