Page 1 of 1

CMSMS 1.11 - News custom fields syntax has changed

Posted: Sun Aug 05, 2012 8:20 pm
by zenojl
Hi,

If you have written customized templates for the news module with CMSMS 1.10.3, you may be interested by this post.
It took me some time to figure out why my news page had some elements missing after I upgraded to 1.11, and here is the solution to this issue. :)

It deals with the display of custom field in summary template.

In CMSMS 10.0.3 you could write if you have a custom field named "header_image"

Code: Select all

{if $entry->header_image}
		<img class="header-image" src="{$entry->file_location}/{$entry->header_image}"/>
{/if}
In CMSMS 1.11, in a summary template, this does not work anymore (no "header_image" field is defined in $entry). You have to write instead:

Code: Select all

{if $entry->fields.header_image->value}
		<img class="header-image" src="{$entry->file_location}/{$entry->fields.header_image->value}"/>
{/if}
In the detail template, on the other hand, both syntaxes are still working.

Enjoy!

Re: CMSMS 1.11 - News custom fields syntax has changed

Posted: Sun Aug 05, 2012 10:49 pm
by calguy1000
FYI: The detail view will soon change to be consistent with the summary view.

Re: CMSMS 1.11 - News custom fields syntax has changed

Posted: Mon Aug 06, 2012 8:32 am
by zenojl
IMHO the direct custom-field syntax "$entry->cust_field_name" is more natural and more template-developper-friendly that "$entry->fields.cust_field_name->value"

So if it does not imply a big performance penalty, I would really prefer that the direct custom-field syntax could be used in both summary view and detail view.

Anyway this is not really an issue as long as the correct syntax is documented in some easy-to-find place.