Maybe I am misreading the instructions that I saw here
http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Extensions/CompanyDirectory
it says to access the extra fields in a template use:
{$entry->customfieldsbyname.yourcustomfieldname}
So I defined a field called firstname and tried
{$entry->customfieldsbyname.firstname}
but it is not pulling in the first names, what am I doing wrong?
site is here:
http://nmrid.org/index.php?page=directory-of-interpreters
[SOLVED] Company directory extra fields do not work in template?
- kittymcooper
- Forum Members
- Posts: 44
- Joined: Sat Aug 02, 2008 4:40 am
[SOLVED] Company directory extra fields do not work in template?
Last edited by kittymcooper on Wed Oct 06, 2010 12:25 am, edited 1 time in total.
Kitty Munson Cooper, web designer, programmer
Re: Company directory extra fields do not work in template?
did you first use a foreach statement to setup the $entry array?
Re: Company directory extra fields do not work in template?
Did you name your field firstname or Firstname?
Note that it is case sensitive, so this could be your problem.
Note that it is case sensitive, so this could be your problem.
- kittymcooper
- Forum Members
- Posts: 44
- Joined: Sat Aug 02, 2008 4:40 am
Re: Company directory extra fields do not work in template?
Thanks for the ideas but the field is definitely called firstname and of course I have a foreach. Here is the code, the other non-custom fields come out fine:
{foreach from=$items item=entry}
{$entry->company_name|capitalize}, {$entry->customfieldsbyname.firstname}
{$entry->address|capitalize}
{if $entry->contact_email ne ''}
{assign var="mail" value=$entry->contact_email}
{mailto address="$mail" text="" encode="javascript_charcode"}
{/if}
{/foreach}
Kitty Munson Cooper, web designer, programmer
Re: Company directory extra fields do not work in template?
just for fun, try taking out the foreach statement...
I have similar code working on one of my sites, and there is no foreach enclosing the {$entry->whatever} variables.
I have similar code working on one of my sites, and there is no foreach enclosing the {$entry->whatever} variables.
- kittymcooper
- Forum Members
- Posts: 44
- Joined: Sat Aug 02, 2008 4:40 am
Re: Company directory extra fields do not work in template?
interesting idea but removing the foreach did not work so I put it back
Kitty Munson Cooper, web designer, programmer
- kittymcooper
- Forum Members
- Posts: 44
- Joined: Sat Aug 02, 2008 4:40 am
[SOLVED] Re: Company directory extra fields do not work in template?
This was really silly. My user had not checked the public box in the custom field definition so it was not appearing.
I solved it by looking at $entry within my loop in my template using the following code to see what was in that object for each item (did view source to see the results as it is within html comments cuz on a live site):
hope this helps someone else
Kitty
I solved it by looking at $entry within my loop in my template using the following code to see what was in that object for each item (did view source to see the results as it is within html comments cuz on a live site):
saw nothing and went looking at the definition more carefully ...
hope this helps someone else
Kitty
Kitty Munson Cooper, web designer, programmer
Re: [SOLVED] Company directory extra fields do not work in template?
hehe, duh... it's always the simple things, right? thanks for coming back and letting us know!