Error with tabbed content / smarty / get_children
Posted: Fri Feb 03, 2017 8:22 am
Hi. I'm running CMS Made Simple 2.1.1. I'm using PHP 5.5.29, and MySQL 5.5.52.
I have code that I've been using to generate tabbed content on one of my pages. I'm using this code instead of setting up the content directly into tabs because the content is lengthy, and it is easier to edit if it is in its own page.
The tabs open and close correctly. There is an error I can't figure out though.
1. If I click on a link in the tabbed content, and am taken to a different page
2.Then go back to the original page
3. Then click in a tab to open the tab
4. The tab doesn't open, and I am automatically taken away to the home page.
I can't figure out the error in my code. Could somebody look at it for me? Thank you! The code is below:
<div aria-multiselectable="true" role="tablist" id="content" class="panel-group" style="margin-bottom:4em">
{$children=cgsimple::get_children('alumni', true, $children)}
{if count($children)}
{foreach from=$children item='child' name='panel'}
{if $child}
<div class="panel panel-default">
<a title="Tab{$smarty.foreach.panel.index}" aria-controls="collapse{$smarty.foreach.panel.index}" aria-expanded="false" href="#collapse{$smarty.foreach.panel.index}" data-parent="#content" data-toggle="collapse" id="heading{$smarty.foreach.panel.index}" role="tab" class="panel-heading collapsed"><i class="fa fa-plus icon-indicator"></i> <span class="panel-title">{cgsimple::get_page_title($child.alias)}</span></a>
<div aria-labelledby="heading{$smarty.foreach.panel.index}" role="tabpanel" class="panel-collapse collapse" id="collapse{$smarty.foreach.panel.index}" aria-expanded="false">
<div class="panel-body">
{eval var={page_attr page=$child.alias key='_dflt_'}}
</div>
</div>
</div>
{/if}
{/foreach}
{/if}
</div>
I have code that I've been using to generate tabbed content on one of my pages. I'm using this code instead of setting up the content directly into tabs because the content is lengthy, and it is easier to edit if it is in its own page.
The tabs open and close correctly. There is an error I can't figure out though.
1. If I click on a link in the tabbed content, and am taken to a different page
2.Then go back to the original page
3. Then click in a tab to open the tab
4. The tab doesn't open, and I am automatically taken away to the home page.
I can't figure out the error in my code. Could somebody look at it for me? Thank you! The code is below:
<div aria-multiselectable="true" role="tablist" id="content" class="panel-group" style="margin-bottom:4em">
{$children=cgsimple::get_children('alumni', true, $children)}
{if count($children)}
{foreach from=$children item='child' name='panel'}
{if $child}
<div class="panel panel-default">
<a title="Tab{$smarty.foreach.panel.index}" aria-controls="collapse{$smarty.foreach.panel.index}" aria-expanded="false" href="#collapse{$smarty.foreach.panel.index}" data-parent="#content" data-toggle="collapse" id="heading{$smarty.foreach.panel.index}" role="tab" class="panel-heading collapsed"><i class="fa fa-plus icon-indicator"></i> <span class="panel-title">{cgsimple::get_page_title($child.alias)}</span></a>
<div aria-labelledby="heading{$smarty.foreach.panel.index}" role="tabpanel" class="panel-collapse collapse" id="collapse{$smarty.foreach.panel.index}" aria-expanded="false">
<div class="panel-body">
{eval var={page_attr page=$child.alias key='_dflt_'}}
</div>
</div>
</div>
{/if}
{/foreach}
{/if}
</div>