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