Page 1 of 1

[SOLVED] Add a News feed to Company Directory Details

Posted: Thu Oct 10, 2013 5:19 pm
by CapereSpiritum
Does anyone know how to add a news feed into the Company Directory details template?

My Site

CMSMS 1.11.9
Company Directory 1.19.4

I have a BNI Members website. Each member will wish to add testimonials to his/her profile (Company Directory)

Tried adding a Field Definition (dropdown) called Profession
Added the following to the details template;

Code: Select all

{if isset($entry->fields)}{if isset($entry->fields.Profession) && $entry->fields.Profession->dropdown_value != ''}
<div id="DtestimonialSum">{news number='3' category='{$entry->fields.Profession->dropdown_value}' summarytemplate='MemberTestimonial'}</div>
{/if}{/if}
I will add a details='page' later when/if it works.

Had a go at adding this in the Details WYSIWYG window

Code: Select all

{news number='3' category='Photography' summarytemplate='MemberTestimonial'}
Kinda stabbing in the dark ::)

Re: Add a News feed to Company Directory Details

Posted: Thu Oct 10, 2013 5:41 pm
by calguy1000
watch your quoting and nested smarty calls.

Re: Add a News feed to Company Directory Details

Posted: Sat Oct 19, 2013 10:25 am
by CapereSpiritum
Hi CalGuy

I've just gone round and round on this.

I cannot even get a basic {News} call to work in the Company Directory details display. Can you tell me the correct syntax for calling the news module in another module like Company Directory?

Thanks
Simon

Re: Add a News feed to Company Directory Details

Posted: Sat Oct 19, 2013 3:30 pm
by Dr.CSS
From what I've heard I think you need to use {cms_module module='moduleName'} when calling one in another...

Re: Add a News feed to Company Directory Details

Posted: Sat Oct 19, 2013 3:58 pm
by calguy1000

Re: Add a News feed to Company Directory Details

Posted: Sun Oct 20, 2013 2:20 pm
by CapereSpiritum
HI Doc & CalGuy

Thanks for the pointers.

I got partial success with

Code: Select all

{cms_module module='News' category="Photographer"}
My intention is to call news articles of the category of the members profile.

I spent several hours attempting to make sense of the info on the smarty.net site. Frankly, it's beyond my current ability.

Is their an 'idiots guide' that can assist me with my limited know-how?

I know that the dropdown field can be called, I just don't know the correct syntax to insert in the {News smarty}

The website I'm doing is for free for the BNI group I am a member of and I thought it would be beneficial to display a small selection of each members testimonials.

Sorry to bug you guys.

Re: Add a News feed to Company Directory Details

Posted: Sun Oct 20, 2013 2:32 pm
by Jo Morg
calguy1000 wrote:watch your quoting and nested smarty calls.
If $entry->fields.Profession->dropdown_value exist and has a valid value then I think this should work:

Code: Select all

{news number='3' category=$entry->fields.Profession->dropdown_value summarytemplate='MemberTestimonial'}
HTH

Re: Add a News feed to Company Directory Details

Posted: Sun Oct 20, 2013 4:16 pm
by CapereSpiritum
Thanks Jo, Dr CSS & CalGuy

Now working as I wanted.

I'm going to experiment with smarty. It's clearly very powerful. Already I can see many useful possibilities for combining the output of multiple modules.

Brilliant....

Re: [SOLVED] Add a News feed to Company Directory Details

Posted: Sun Oct 20, 2013 6:08 pm
by Dr.CSS
Care to show/tell how you got it working/fixed..?

Re: [SOLVED] Add a News feed to Company Directory Details

Posted: Mon Oct 21, 2013 3:20 pm
by CapereSpiritum
Hi Doc, sure...
In Company Directory (my favourite module) I added a Field Definition Dropdown called 'Profession' which is called in the Details Template with the 'if' statement below.
Followed by the {News Call} Corrected by yourself {cms_module module='News' } calling the summary template in the normal way and then adding rest of the 'if' Profession call as per category=... close the 'if's

Code: Select all

{if isset($entry->fields)} {if isset($entry->fields.Profession) && $entry->fields.Profession->dropdown_value != ''}   

{cms_module module='News' number='3' summarytemplate='MemberTestimonial' sortby='random' category=$entry->fields.Profession->dropdown_value}  

{/if}{/if}
Here's the site Try the Photographer to see the results. Not many have added their testimonials yet.

Can't get enough of CMSMS