Page 1 of 1

News module field definitions [solved]

Posted: Wed Oct 09, 2013 5:05 pm
by douglas1438
Hi all,

Have a news summary template and two field definitions set up, using an if statement to show HTML depending on if field definition has any content.

I've used this code on other sites without any problem, but this one shows the HTML style if it is true or false.

Code: Select all

{if $entry->fieldsbyname.clientname != ''}
<p class="newsClientHeading">Client:</p>
<p class="newsClient">{$entry->fieldsbyname.clientname->value}</p>
{/if}
I have {process_pagedata} at the start of my template and $config['process_whole_template'] = false; in my config file.

CMSMS version 1.11
News module version 2.12.7

Thank you

Re: News module field definitions

Posted: Wed Oct 09, 2013 5:45 pm
by Jo Morg
douglas1438 wrote:using an if statement to show HTML depending on if field definition has any content.
Testing if a field has content:

Code: Select all

{if $entry->fieldsbyname.clientname->value != ''}
<p class="newsClientHeading">Client:</p>
<p class="newsClient">{$entry->fieldsbyname.clientname->value}</p>
{/if}
Testing if the field definition exists:

Code: Select all

{if isset($entry->fieldsbyname.clientname)}
<p class="newsClientHeading">Client:</p>
<p class="newsClient">{$entry->fieldsbyname.clientname->value}</p>
{/if}