Welcome
We've been working hard

Imperial CMS judges that the field value is empty and displays different contents

today Imperial cms tutorial network The method of displaying different content when the shared judgment field value is empty is applicable to content pages and list pages. You can take one example and use it flexibly! The empire is very powerful, only unexpected, nothing can not be done.

Imperial CMS judges that the field value is empty and displays different contents

For the content page, use the variable $navinfor [field]:

$bqr is used when it is a smart tag

$navinfor is used when it is a content template

The codes are as follows:

 <? if($bqr[titlepic]=="") { echo ''; } else{ echo '<a href='.$ bqsr[titleurl].'>< img src='.$ bqr[titlepic].'></ a>'; } ?>

 

In the list page, you can use program code in list.var. Relevant labels are as follows:

 if(empty($r[titlepic])) { $r[titlepic]='/images/img.gif'; }

 

be careful:

All PHP code must be used in the list page. Otherwise, an error will be reported? Add PHP code directly without adding program start and end tags. The field value array variable is $r, and the corresponding field variable is $r [field name]. For example, the header field variable is $r [title]. In addition, the numbered variable is $no, and the final template content is assigned to the $listtemp variable:

 <? php if($navinfor[cnurl]) { ?> Echo 'Displayed content'; <? } else { ?> echo ''; <? } ?>

 

Like( zero ) Reward
Do not reprint without permission: New Start Blog » Imperial CMS judges that the field value is empty and displays different contents


Follow the public account "New Start Software Steward"

Get the latest network resources and cracking software!
Play with all kinds of software

comment Grab the sofa

You must log in before commenting!

 

Reward the author of the article if you think it is useful

Thank you very much for your reward, we will continue to give more high-quality content, let's create a better online world together!

Scan Alipay and reward

Scan WeChat and reward