I'm sure this has been asked before - but I can't find it if it has! And I'm sorry if its a dumb question but its not mentioned in the module help (... it really should be!) but...
If I have created a custom field called 'image' which is of the 'linked file' type.. how do I display this in a News template? I had assumed something like
{$entry->image}
would do it but it doesnt...
thanks ...
News module - displaying custom field in template
-
- Forum Members
- Posts: 235
- Joined: Mon Nov 26, 2018 3:09 pm
Re: News module - displaying custom field in template
The sample templates give a good clue in how they show the custom fields, and the array is described in the "template help" page when in Design Manager (but yes, it probably could be referenced in the actual module help, too - this is an old module that needs a lot of love). Don't forget you can always do a <pre>{$entry|print_r}</pre> or <pre>{$entry->fields|print_r}<./pre> in your template to show everything you have available.
If you don't want to do a foreach like in the sample templates you can access them directly with:
where fieldname is the name of your custom field.
If you don't want to do a foreach like in the sample templates you can access them directly with:
Code: Select all
{$entry->fields.fieldname->value}
Not getting the answer you need? CMSMS support options
-
- Forum Members
- Posts: 235
- Joined: Mon Nov 26, 2018 3:09 pm
Re: News module - displaying custom field in template SOLVED
Perfect - thanks!