Page 1 of 1

Smarty code stopped working upon CMS update

Posted: Sun Nov 24, 2013 6:35 pm
by cpansewicz
Hi,

I was wondering if somebody could help me troubleshoot this? I know there were some smarty updates with the last CMS update, but I'm not sure how they affect the smarty code I wrote.

I wrote code that would pull content from child pages into my tabs. When I updated the CMS my tabs stopped working correctly. Two issues where happening, when I turned off a page, it was still showing up in the tabs. And the navigation from tab to tab stopped working as well. The code is below. It was working fine on CMS 1.11.4, but not 1.11.9.

Thank you for any advice. I have tabs on almost all of my pages, and need to correct this.

<div id="tabs">
<ul>
{assign var='count' value='1'}
{foreach from=$cgsimple->get_children('page-name', true, $children) item='child'}
{if $child}<li><a href="#tab-{$count++}">{$cgsimple->get_page_title($child.alias)}</a></li>{/if}
{/foreach}
</ul>
{assign var='count' value='1'}
{foreach from=$cgsimple->get_children('page-name', true, $children) item='child'}
{if $child}<div id="tab-{$count++}" style="font-size: 110%;clear:both;">{eval var=$cgsimple->get_page_content($child.alias)}</div>{/if}
{/foreach}
</div>

Re: Smarty code stopped working upon CMS update

Posted: Sat Dec 28, 2013 8:07 pm
by Dr.CSS
When you upgraded CMSMS did you make sure you upgraded all your modules..?

Re: Smarty code stopped working upon CMS update

Posted: Thu Jan 09, 2014 4:42 am
by cpansewicz
Yes I did update the modules. One of the things that stopped working was my navigation from tab to tab. I think this part of the code is causing issues, but I wasn't sure out how to rewrite it:

{assign var='count' value='1'}
{foreach from=$cgsimple->get_children('page-name', true, $children) item='child'}
{if $child}<li><a href="#tab-{$count++}">

The other issue was my inactive pages were showing up in the tabbed navigation, when they should have been inactive.

Re: Smarty code stopped working upon CMS update

Posted: Thu Jan 09, 2014 3:32 pm
by JohnnyB
If you updated all of the modules, check out the Help for CGSimpleSmarty under your list of Modules. I think static methods were added sometime 2013.

Now all of the examples show this:
{cgsimple::get_children('',0,'children')}
Maybe your code will work better like this?

Code: Select all

{assign var='count' value='1'}
{foreach from=$cgsimple::get_children('page-name', true, $children) item='child'}
{if $child}<li><a href="#tab-{$count++}">
Also, wouldn't it be written like this to assign a variable called, 'children'?
{foreach from=$cgsimple::get_children('page-name', true, 'children') item='child'}

And, 'page-name' is a page alias, correct?