Imperial CMS list template Listvar support program code

Source: Internet
Author: User
1, add template when List.var template need to check “ use program code ” options.

2, directly add PHP code, do not need add

Examples of List.var templates:
Example 1: Displays the specified picture if the message does not have a caption picture set.

1if (Empty ($r [titlepic])) 2{3        $r [titlepic]= '/images/img.gif '; 4}5 $listtemp = ' <li><a href= ' [!-- titleurl--] ">a>li>";

Description: $r [Titlepic] is the title picture field variable. $listtemp as a template content variable.

Example 2: If the information is released today on the display &ldquo; new&rdquo; picture identification.

1$newimg= '; 2 if (Time ()-$r [newstime]<=1*24*3600) 3{4        $newimg = '  '; 5}6 $ listtemp= ' <li><a href= "[!--titleurl--]" >[!--title--]a> '. $newimg. ' Li> ';

Description: $r [Newstime] is the Publish Time field variable. $listtemp as a template content variable.

Example 3: Call the company name of the contributing user.

1$userr= $empire->fetch1 ("select company from {$dbtbpre}enewsmemberadd where userid= ' $r [userid] ' limit 1"); 2 $ listtemp= ' <li><a href= "[!--titleurl--]" >[!--title--]a><span> Company name: '. $userr [companies]. ' Span>li> ';

Description: $r [UserID] is the Publisher User ID field variable. $listtemp as a template content variable.

Other Notes:
If the $listtemp reference template content is in single quotation marks, then the inside use single quotation marks in front to add \, for example: $listtemp = ' ';
Conversely, if the reference template content is double quotation marks, then the inside use double quotation marks before also add \, for example: $listtemp = "Support Program code can implement many very complex application requirements.

The above describes the Imperial CMS list template Listvar support program code, including the aspects of the content, I hope to be interested in PHP tutorial friends helpful.

  • 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.