CMSMS 1.11 - News custom fields syntax has changed

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
zenojl
New Member
New Member
Posts: 3
Joined: Sun Jun 24, 2012 5:06 pm

CMSMS 1.11 - News custom fields syntax has changed

Post 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!
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: CMSMS 1.11 - News custom fields syntax has changed

Post by calguy1000 »

FYI: The detail view will soon change to be consistent with the summary view.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
zenojl
New Member
New Member
Posts: 3
Joined: Sun Jun 24, 2012 5:06 pm

Re: CMSMS 1.11 - News custom fields syntax has changed

Post 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.
Locked

Return to “[locked] Installation, Setup and Upgrade”