Page 1 of 1

[SOLVED] Getting extra fields values in CompanyDirectory

Posted: Mon Jan 13, 2014 3:09 pm
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

Re: Getting extra fields values in CompanyDirectory (Smarty)

Posted: Mon Jan 13, 2014 3:24 pm
by JohnnyB
Does this not work?
{if isset($entry->fields.my_field1) && $entry->fields.my_field1->value != ''}{$entry->fields.my_field1->value}{/if}

Re: Getting extra fields values in CompanyDirectory (Smarty)

Posted: Mon Jan 13, 2014 4:36 pm
by Mich-adg
Perfect !!! Many thanks, i didn't know it was so "simple" to write!