Smarty code stopped working upon CMS update

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

Smarty code stopped working upon CMS update

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

Re: Smarty code stopped working upon CMS update

Post by Dr.CSS »

When you upgraded CMSMS did you make sure you upgraded all your modules..?
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Smarty code stopped working upon CMS update

Post 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.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Smarty code stopped working upon CMS update

Post 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?
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Post Reply

Return to “Modules/Add-Ons”