News module field definitions [solved]

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
douglas1438
Forum Members
Forum Members
Posts: 80
Joined: Thu Jul 21, 2011 10:29 am

News module field definitions [solved]

Post 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
Last edited by douglas1438 on Wed Oct 16, 2013 4:58 pm, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: News module field definitions

Post 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}
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Post Reply

Return to “Modules/Add-Ons”