[SOLVED] Add a News feed to Company Directory Details

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

[SOLVED] Add a News feed to Company Directory Details

Post 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 ::)
Last edited by CapereSpiritum on Sun Oct 20, 2013 4:17 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Add a News feed to Company Directory Details

Post by calguy1000 »

watch your quoting and nested smarty calls.
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.
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

Re: Add a News feed to Company Directory Details

Post 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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Add a News feed to Company Directory Details

Post by Dr.CSS »

From what I've heard I think you need to use {cms_module module='moduleName'} when calling one in another...
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Add a News feed to Company Directory Details

Post by calguy1000 »

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.
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

Re: Add a News feed to Company Directory Details

Post 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.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Add a News feed to Company Directory Details

Post 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
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

Re: Add a News feed to Company Directory Details

Post 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....
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

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

Post by Dr.CSS »

Care to show/tell how you got it working/fixed..?
CapereSpiritum
Forum Members
Forum Members
Posts: 223
Joined: Wed Dec 28, 2011 12:11 pm

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

Post 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
Post Reply

Return to “Modules/Add-Ons”