Company Directory module - display content of custom fields
Company Directory module - display content of custom fields
Has anyone figured out how to display the contents of specific custom fields with the company directory module? Help and documentation for the module is non-existant. From the sample templates, I can see how to output all of the custom fields. But, I want to modify the summary template to output the contents of just one of my custom fields.
Thanks in advance,
Tim
Thanks in advance,
Tim
Re: Company Directory module - display content of custom fields
Hmm, as far as I can see from examining the code the custom fields are not assigned to smarty/the template...
Regards,
D
Regards,
D
Re: Company Directory module - display content of custom fields
They are not assigned in the summary view, but when you view company details the custom fields are assigned.
This is the code in the detail template that shows them:
Use the attached action.default.php to also assign the custom fields to the summary. Use this code in the Summary Template to show them:
Regards,
D
[gelöscht durch Administrator]
This is the code in the detail template that shows them:
Code: Select all
{if $customfieldscount gt 0}
{foreach from=$customfields item=customfield}
{$customfield->name}: {$customfield->value}<br />
{/foreach}
{/if}
Code: Select all
{if $entry->customfieldscount gt 0}
{foreach from=$entry->customfields item=customfield}
{$customfield->name}: {$customfield->value}<br />
{/foreach}
{/if}
D
[gelöscht durch Administrator]
Last edited by Anonymous on Fri Jan 05, 2007 12:50 am, edited 1 time in total.
Re: Company Directory module - display content of custom fields
Thanks Dee. How can I show the contents of just one of the custom fields though? Let's say I add a custom field called Slogan and I want to display the company's name, web site and slogan on my summary page...it would be great if I could do something like this:
I'd even deal with {$customfields[0]} where the number is the custom field's number in the compdir_fielddefs table.
Tim
Code: Select all
Name: {$entry->company_name_link}<br />
{if $entry->website ne ''}
Website: <a href="{$entry->website}">{$entry->website}</a><br />
{/if}
{if $customfields->slogan ne ''}
Slogan: {$customfields->slogan}<br />
{/if}
Tim
Re: Company Directory module - display content of custom fields
I figured it out! With your patch applied, I can output the value of a custom field using:
{$entry->customfields[1]->value}
Where the number is the custom field's number, using cardinal numbering (i.e. the first custom field is 1 not 0).
Any idea how I can output a list of the categories (as links) rather than the drop-down list form element?
Tim
{$entry->customfields[1]->value}
Where the number is the custom field's number, using cardinal numbering (i.e. the first custom field is 1 not 0).
Any idea how I can output a list of the categories (as links) rather than the drop-down list form element?
Tim
Re: Company Directory module - display content of custom fields
You could also use
Code: Select all
{if $entry->customfieldscount gt 0}
{foreach from=$entry->customfields item=customfield}
{if $customfield->name == 'slogan' and $customfield->value ne ''}
{$customfield->name}: {$customfield->value}<br />
{/if}
{/foreach}
{/if}
Last edited by Anonymous on Fri Jan 05, 2007 3:03 am, edited 1 time in total.
Re: Company Directory module - display content of custom fields
In action.default.php at the start afterskypanther wrote: Any idea how I can output a list of the categories (as links) rather than the drop-down list form element?
Code: Select all
if (isset($_POST[$id.'inputcat']))
{
$inputcat = $_POST[$id.'inputcat'];
}
Code: Select all
if (isset($params['inputcat']))
{
$inputcat = $params['inputcat'];
}
Code: Select all
$catarray = array('(Select One)' => '');
while ($dbresult && $row = $dbresult->FetchRow())
{
$catarray[$row['name']] = $row['id'];
}
$this->smarty->assign('catformstart', $this->CreateFrontendFormStart($id, $returnid));
$this->smarty->assign('catdropdown', $this->CreateInputDropdown($id, 'inputcat', $catarray, -1, $inputcat, ''));
$this->smarty->assign('catbutton', $this->CreateInputSubmit($id, 'inputsubmit', 'Submit'));
$this->smarty->assign('catformend', $this->CreateFormEnd());
Code: Select all
$html = '';
while ($dbresult && $row = $dbresult->FetchRow())
{
$html .= $this->CreateLink($id, 'default', $returnid, $row['name'], array('inputcat' => $row['id']));
$html .= '<br />';
}
$this->smarty->assign('catformstart', $html);
D
[gelöscht durch Administrator]
Re: Company Directory module - display content of custom fields
Many thanks! It outputs the category list just fine. Ultimately, what I'd like is a list of categories on one page that then links to another page listing the companies w/in that category. I'll play with this code and give a go at making that sort of modification.
Thanks so much,
Tim
Thanks so much,
Tim
-
- Forum Members
- Posts: 126
- Joined: Sun Feb 26, 2006 7:10 pm
Re: Company Directory module - display content of custom fields
Dee, this all helped me out tons. I have a few questions if you have the time.
1. For my purposes it would be absolutely ideal if when you clicked on the link for a detailed view of a company it was done in a pop-up. Is there anyway to add attributes to the anchor that is created like class="external" or something?
2. I'm using the category view you created instead of the drop down list. When I click on a category I lose the list of cateogories. Is there a way to keep that on the template all the time?
3. How about adding a contextual back link or something so you don't have to use the back button each time?
I'd love to be able to add this functionality. I appreciate your help.
Jeff
1. For my purposes it would be absolutely ideal if when you clicked on the link for a detailed view of a company it was done in a pop-up. Is there anyway to add attributes to the anchor that is created like class="external" or something?
2. I'm using the category view you created instead of the drop down list. When I click on a category I lose the list of cateogories. Is there a way to keep that on the template all the time?
3. How about adding a contextual back link or something so you don't have to use the back button each time?
I'd love to be able to add this functionality. I appreciate your help.
Jeff
Re: Company Directory module - display content of custom fields
I have a very basic question.
Once I install Company Directory, what do I add to my template to get it onto my site? Or how do I create a directory page?
thanks,
bex
Once I install Company Directory, what do I add to my template to get it onto my site? Or how do I create a directory page?
thanks,
bex
Re: Company Directory module - display content of custom fields
{cms_module module='companydirectory'} is all you should need to display it on the frontend.
Ted
Ted
Re: Company Directory module - display content of custom fields
Thank you, that worked perfectly.
So I can learn from my ways - where did you find this documented (directly or indirectly)?
thanks,
bex
So I can learn from my ways - where did you find this documented (directly or indirectly)?
thanks,
bex
Re: Company Directory module - display content of custom fields
bex,
{cms_module module='module_name'}
is the standard way to output the results of any module in CMS-MS. Most modules should tell you what to put in the module="" parameter. From the Extensions menu, choose Modules. Next to the module in question, click Help. The help docs should include the module name and other pertinent info. In this case, the company directory module is essentially undocumented.
Tim
PS: This is also a little hint to modules developers to always include such info!
{cms_module module='module_name'}
is the standard way to output the results of any module in CMS-MS. Most modules should tell you what to put in the module="" parameter. From the Extensions menu, choose Modules. Next to the module in question, click Help. The help docs should include the module name and other pertinent info. In this case, the company directory module is essentially undocumented.
Tim
PS: This is also a little hint to modules developers to always include such info!

Re: Company Directory module - display content of custom fields
Plus, I wrote the thing. 
It was written for a client who knew how it worked and what the requirements are. I never got around to writing the help function since he didn't really need it. And then I just released it as GPL without really thinking twice about it. I'll get around to it eventually.

It was written for a client who knew how it worked and what the requirements are. I never got around to writing the help function since he didn't really need it. And then I just released it as GPL without really thinking twice about it. I'll get around to it eventually.

Re: Company Directory module - display content of custom fields
Ted,
I have a need to add functionality to this module. I've been tinkering with it for a week or so and hope to have something to share within the next week or so. I can add some rudimentary documentation at that point. Perhaps that will suffice or maybe you can round it out at that point.
Tim
I have a need to add functionality to this module. I've been tinkering with it for a week or so and hope to have something to share within the next week or so. I can add some rudimentary documentation at that point. Perhaps that will suffice or maybe you can round it out at that point.
Tim