Page 1 of 1
How to retreive custom field values in News module directly?
Posted: Tue Sep 02, 2014 10:26 pm
by 10010110
I have a custom field in my News module called “Publication/medium”, and I want to display the value of this field in a custom location in my summary template, i. e. outside of the foreach loop in which the custom fields are usually retreived. How would I have to go about this?
I tried {$entry->fields.Publication/medium->value} as well as {$entry->fields.Publication/medium.value} but nothing is working.

Re: How to retreive custom field values in News module direc
Posted: Tue Sep 02, 2014 11:10 pm
by Jo Morg
http://forum.cmsmadesimple.org/viewtopi ... es+in+News
Search still works for me

...
BTW where does the
/ comes from?
Re: How to retreive custom field values in News module direc
Posted: Wed Sep 03, 2014 3:42 am
by chandra
A slash is not allowed inside var name.
Re: How to retreive custom field values in News module direc
Posted: Wed Sep 03, 2014 1:26 pm
by 10010110
The slash is part of the field name. There is only the option of giving the field a name (i. e. there is no alias field or whatever), and apparently it’s possible to put any character in the name field. So, how is the field retreived then if not by name? The characters are probably escaped somehow, no?
And by the way: how comes this thread is in the lounge? Has it been moved? Because I was sure I posted it in the Product Support forum.
I’m probably working way too much, I can’t even think straight anymore.
Re: How to retreive custom field values in News module direc
Posted: Wed Sep 03, 2014 1:33 pm
by Jo Morg
If the
/ is acceptable (which I'm not sure) this should work afaik:
Code: Select all
{$entry->fieldsbyname.Publication/medium->value}
Re: How to retreive custom field values in News module direc
Posted: Wed Sep 03, 2014 6:07 pm
by chandra
Smarty follows the php naming rules for variables
http://php.net/manual/en/language.variables.basics.php
As you can see slash is not allowed. A slash is reserved as separator between folders

.
Re: How to retreive custom field values in News module direc
Posted: Thu Sep 04, 2014 5:53 pm
by Dr.CSS
Most likely it was moved from product support because you were asking about a 'module' not the core, even if News comes pre-installed...
Re: How to retreive custom field values in News module direc
Posted: Thu Sep 04, 2014 5:57 pm
by Rolf
I moved the thread to Modules/Add-Ons board