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.
CGCalendar: Add Category Logic to Event Detail Page
-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: CGCalendar: Add Category Logic to Event Detail Page
Calling the global_content will render it through smarty the {eval} isn't needed.
Code: Select all
{global_content name='content'}-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: CGCalendar: Add Category Logic to Event Detail Page
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!
Thanks!
Re: CGCalendar: Add Category Logic to Event Detail Page
What isn't working the {global_content} call? or the {if}?
Try debugging with printing
Try debugging with printing
Code: Select all
<pre>{$event|print_r}</pre>-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: CGCalendar: Add Category Logic to Event Detail Page
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!
{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!
Re: CGCalendar: Add Category Logic to Event Detail Page
Use something like strstr to find a string within a string? See
http://www.smarty.net/forums/viewtopic.php?p=66879
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
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016

