[Solved] Is it possible to order Field Definitions in CompanyDirectory?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
ACDS
Forum Members
Forum Members
Posts: 17
Joined: Tue Jul 12, 2011 12:02 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by ACDS »

M@rtijn just a follow-up...

In terms of the coding...I am not sure which code to leave an which to take out. I get all kinds of errors on my front end.

Do I leave the following as is:

Code: Select all

{if $customfieldscount gt 0}
   {foreach from=$customfields item=customfield}
      {$customfield->name}: {$customfield->value}<br />
   {/foreach}
{/if}
and then just add the rest below?

Code: Select all

{if $entry->customfieldsbyname.Yourname ne ''}
{$entry->customfieldsbyname.Yourname}
{/if}
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by M@rtijn »

No problem, that's why we are here ;D

The first piece of code will show all the customfields, even if the value is zero (or in your case unchecked).
So I suggest removing that bit.

You say you get errors? Can you post them here?
Make your community a better place!
ACDS
Forum Members
Forum Members
Posts: 17
Joined: Tue Jul 12, 2011 12:02 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by ACDS »

Hi Martijn,

I have not had time to further work on this until now. I think the problem I have is that my custom fields contains a number of words e.g. General disaster risk reduction...

thus this code seems wrong:

Code: Select all

{if $entry->customfieldsbyname.General disaster risk reduction ne ''}
{$entry->customfieldsbyname.General disaster risk reduction}
{/if}


This provides the following error on the front end:

Code: Select all

Parse error: syntax error, unexpected T_STRING in /usr/www/users/acds/tmp/templates_c/CompanyDirectory^%%2B^2B8^2B838308%%module_db_tpl%3ACompanyDirectory%3Bdetail_Sample.php on line 56
ACDS
Forum Members
Forum Members
Posts: 17
Joined: Tue Jul 12, 2011 12:02 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by ACDS »

Hi Martijn,

I have not had time to further work on this until now. I think the problem I have is that my custom fields contains a number of words e.g. General disaster risk reduction...

thus this code seems wrong:

Code: Select all

{if $entry->customfieldsbyname.General disaster risk reduction ne ''}
{$entry->customfieldsbyname.General disaster risk reduction}
{/if}


This provides the following error on the front end:

Code: Select all

Parse error: syntax error, unexpected T_STRING in /usr/www/users/acds/tmp/templates_c/CompanyDirectory^%%2B^2B8^2B838308%%module_db_tpl%3ACompanyDirectory%3Bdetail_Sample.php on line 56
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by M@rtijn »

Yes, the spaces terminate the call.

Just use a single word for your custom fields or underscore the spaces.

If you really want it to show 'General disaster risk reduction' you could make a custom template file (search for 'module_custom') or edit the labels in the lang file.
Make your community a better place!
User avatar
Tetsuo
Forum Members
Forum Members
Posts: 58
Joined: Wed Aug 19, 2009 12:00 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by Tetsuo »

M@rtijn wrote:Yes, the spaces terminate the call.

Just use a single word for your custom fields or underscore the spaces.
Underscoring / removing the spaces stops the error, but it doesn't call the entry.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by calguy1000 »

This should work:

Code: Select all

{assign var='tmp' value='My field name with spaces in it'}
{$entry->customfieldsbyname.$tmp->value}
Please read the smarty documentation... you will find alot of useful information there... including how to handle array keys with spaces in them.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Tetsuo
Forum Members
Forum Members
Posts: 58
Joined: Wed Aug 19, 2009 12:00 pm

Re: [Solved] Is it possible to order Field Definitions in Co

Post by Tetsuo »

Thanks, but that still doesn't output anything, unless I have missed something more obvious:

Code: Select all

{assign var='tmp' value='Address Line 3'}
{if $entry->customfieldsbyname.$tmp->value ne ''}
<h3>Address Line 3:</h3>
<p>{$entry->customfieldsbyname.$tmp->value}</p>
{/if}
Post Reply

Return to “Modules/Add-Ons”