[Solved] How can I call news module custom fields?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

[Solved] How can I call news module custom fields?

Post by Torpedine »

I need to call the custom fields in the news module templates, but {$entry->fieldname} does not work. How can I do it?

Thanks in advance
Last edited by Torpedine on Fri May 30, 2014 11:08 am, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: How can I call new module custom fields?

Post by Jo Morg »

I think it changed to {$entry->fields.fieldname}.
As usual you can find what is available with {get_template_vars} and {$<whatervervarname>|print_r}.
I believe {$entry->fields|print_r} will give some clues to what you need.
HTH.
"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!
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

Re: How can I call new module custom fields?

Post by Torpedine »

I tried {$entry->fields.fieldname} - Using the field name {$entry->fields.Provincia}, but the output is a non formatted page without template...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: How can I call new module custom fields?

Post by Jo Morg »

Sorry my bad... try {$entry->fields->Provincia}. This syntax worked on a test I just did.
"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!
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

Re: How can I call new module custom fields?

Post by Torpedine »

It seems I cannot display anything.
I tried {$entry->fields->fieldname} but nothing is displayed. I tried with the capitalised version of the field (Provincia) and the uncapitalised one (provincia)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: How can I call new module custom fields?

Post by Jo Morg »

What template are you using? Summary? Detail?
"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!
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

Re: How can I call new module custom fields?

Post by Torpedine »

Summary, but I have to do something similar also in detail
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: How can I call new module custom fields?

Post by Jo Morg »

My 1st answer was almost correct:

Code: Select all

{$entry->fields.Provincia->value}
I was in a bit of a hurry when I replied before, sorry. This should work in both templates, in the summary template it has to be inside the foreach loop that iterates through all the entries.
If you use {$entry->fields.Provincia|print_r} you will see how to call the other components of the field.
"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!
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

Re: How can I call news module custom fields?

Post by Torpedine »

Thank you! It works perfectly!
It should be put in the module help...
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: [Solved] How can I call news module custom fields?

Post by Jo Morg »

Torpedine wrote:It should be put in the module help...
The sample templates do have a very comprehensive help text in Smarty comments. May not be easy at 1st but it's all there and once you find your bearings it's not that difficult.
"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”