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>
Error with tabbed content / smarty / get_children
-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
-
chandra
Re: Error with tabbed content / smarty / get_children
Why you doesn't use separate content blocks for every tab? It's a lot easier ... and your solution is not really performance friendly.cpansewicz wrote: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.
Can't see any problem inside your code. Maybe you can provide a link?
By the way - you could try to use a more modern, shorter and clear code style too
Code: Select all
{if count($children)}
{foreach $children as $child'}
<div class="panel panel-default">
<a title="Tab{$child@index}" aria-controls="collapse{$child@index}" aria-expanded="false" href="#collapse{$child@index}" data-parent="#content" data-toggle="collapse" id="heading{$child@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>-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: Error with tabbed content / smarty / get_children
Hi,
Thanks for sending that. I would love to be more modern
) I didn't put them in sep. content blocks because there are 11 accordions. Here is a link to the page to see the situation:
https://www.unmalumni.com/award-recipients.html
Thanks for sending that. I would love to be more modern
https://www.unmalumni.com/award-recipients.html
-
cpansewicz
- Forum Members

- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
SOLVED: Error with tabbed content / smarty / get_children
This has been solved. I needed to change:
href="#collapse{$child@index}" to
href="{$smarty.server.REQUEST_URI}#collapse{$child@index}".
href="#collapse{$child@index}" to
href="{$smarty.server.REQUEST_URI}#collapse{$child@index}".
