CGCalendar: Add Category Logic to Event Detail Page

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

CGCalendar: Add Category Logic to Event Detail Page

Post by cpansewicz »

Hi,

I would like to add logic to my event detail page, where if an event falls in a certain category, specific content would show up. Does this code look correct to add to the Calendar detail page template?

{if $event.category_names == 'Category Name'}
<aside>
{global_content name='content' assign='content'}
{eval var=$content}
</aside>
{/if}

Thank you.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: CGCalendar: Add Category Logic to Event Detail Page

Post by Jeff »

Calling the global_content will render it through smarty the {eval} isn't needed.

Code: Select all

{global_content name='content'}
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: CGCalendar: Add Category Logic to Event Detail Page

Post by cpansewicz »

Yes. Thanks for getting back to me. Even if I eliminate the eval variable, the logic isn't calling in the global content. Is there something else I am missing?

Thanks!
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm

Re: CGCalendar: Add Category Logic to Event Detail Page

Post by Jeff »

What isn't working the {global_content} call? or the {if}?

Try debugging with printing

Code: Select all

<pre>{$event|print_r}</pre>
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: CGCalendar: Add Category Logic to Event Detail Page

Post by cpansewicz »

I was able to add this into my template and see the results. It is this part of the code that isn't working:

{if $event.category_names == 'Category Name'}

I know what the issue is, but don't know how to change the code. The issue is that the event belongs to several categories, and does not just equal one Category Name. How would I change the if statement to say that.

Thanks!
User avatar
paulbaker
Dev Team Member
Dev Team Member
Posts: 1465
Joined: Sat Apr 18, 2009 10:09 pm
Contact:

Re: CGCalendar: Add Category Logic to Event Detail Page

Post by paulbaker »

Use something like strstr to find a string within a string? See
http://www.smarty.net/forums/viewtopic.php?p=66879
To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation

CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Post Reply

Return to “Modules/Add-Ons”