[SOLVED] Getting extra fields values in CompanyDirectory

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Mich-adg
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 02, 2008 9:08 pm

[SOLVED] Getting extra fields values in CompanyDirectory

Post by Mich-adg »

Hi,

i'm not completely a newbie with smarty, but i have big problems to do a simple thing: i created 2 extra fields (my_field1 , my_field2) in Company Directory.
What i want is to dislay a specific fields where i need.
After looking a while on the good syntax to use, after many tries i give up and come to you with my question ^^
When i display with {$entry->fields|@print_r} i see:
Array ( [my_field1] => stdClass Object ( [id] => 1 [name] => my_field1 [type] => textbox [max_length] => 255 [create_date] => 2014-01-13 10:06:13 [modified_date] => 2014-01-13 10:06:13 [item_order] => 1 [admin_only] => 0 [public] => 1 [dropdown_data] => [data] => [fielddef_id] => 1 [value] => mydata1 ) [my_field2] => stdClass Object ( [id] => 2 [name] => my_field2 [type] => textbox [max_length] => 255 [create_date] => 2014-01-13 10:06:27 [modified_date] => 2014-01-13 10:06:27 [item_order] => 2 [admin_only] => 0 [public] => 1 [dropdown_data] => [data] => [fielddef_id] => 2 [value] => mydata2 ) ) 1
So, what i want is to display the "mydata1", and it makes me crazy cause i don't see what's the good syntax to achieve this.
I tried the "customfieldsbyname.my_field1" method but nothing to do...

Any help is welcome !!

Thks,

I use CD 1.20 and cmsms 1.11.9
Last edited by Mich-adg on Mon Jan 13, 2014 4:36 pm, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Getting extra fields values in CompanyDirectory (Smarty)

Post by JohnnyB »

Does this not work?
{if isset($entry->fields.my_field1) && $entry->fields.my_field1->value != ''}{$entry->fields.my_field1->value}{/if}
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Mich-adg
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 02, 2008 9:08 pm

Re: Getting extra fields values in CompanyDirectory (Smarty)

Post by Mich-adg »

Perfect !!! Many thanks, i didn't know it was so "simple" to write!
Post Reply

Return to “Modules/Add-Ons”