Adapting smarty to work with CMS 2.1.1
-
- Forum Members
- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Adapting smarty to work with CMS 2.1.1
Hi, I have code that I wrote that worked with CMS 1.x that used smarty to generate tabbed content and accordion content. I don't know enough about smarty to adapt the code to work with the new cms. Would somebody be willing to look at the code and let me know what I need to change? I would really appreciate any help.
Re: Adapting smarty to work with CMS 2.1.1
http://www.cmscanbesimple.org/blog/smar ... e-examples
And read in the next post the part about Smarty security settings http://www.cmscanbesimple.org/blog/gett ... -in-smarty
And read in the next post the part about Smarty security settings http://www.cmscanbesimple.org/blog/gett ... -in-smarty
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
-
- Forum Members
- Posts: 142
- Joined: Fri Jun 17, 2011 12:22 am
Re: Adapting smarty to work with CMS 2.1.1
Thank you. Those links will be helpful as I work through adjusting my page templates. I should have been more clear in my post. One is a template for the News module, one is code that I put in a Global Content Block.
I know that the $cgsimple smarty variables have changed, but I'm not sure how to apply those changes, or if syntactically what I put together is correct.
I have attached the code below.
This one is for the News Template, and will generate accordion panels:
<div aria-multiselectable="true" role="tablist" id="accordion" class="panel-group">
{assign var='count' value='1'}
{foreach from=$items item=entry name=panel}
<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="#accordion" 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">{$entry->title|cms_escape:htmlall}</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">
<p>{if isset($entry->thumbnail)}<a href="{$entry->thumblink}"><img src="{$entry->file_location}/{$entry->thumbnail}" alt="{$entry->title}" title="{$entry->title}" style="float:right"/></a>{/if}
{if $entry->content}{eval var=$entry->content}{/if}</p>
</div>
</div>
</div>
{/foreach}
</div>
This is the one I put in a Global Content Block that generates tabbed content:
<div aria-multiselectable="true" role="tablist" id="accordion" class="panel-group marginbottom30">
{assign var='count' value='1'}
{foreach from=$cgsimple->get_children($page_alias, true, $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="#accordion" 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=$cgsimple->get_page_content($child.alias)}
</div>
</div>
</div>
{/if}
{/foreach}
</div>
I know that the $cgsimple smarty variables have changed, but I'm not sure how to apply those changes, or if syntactically what I put together is correct.
I have attached the code below.
This one is for the News Template, and will generate accordion panels:
<div aria-multiselectable="true" role="tablist" id="accordion" class="panel-group">
{assign var='count' value='1'}
{foreach from=$items item=entry name=panel}
<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="#accordion" 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">{$entry->title|cms_escape:htmlall}</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">
<p>{if isset($entry->thumbnail)}<a href="{$entry->thumblink}"><img src="{$entry->file_location}/{$entry->thumbnail}" alt="{$entry->title}" title="{$entry->title}" style="float:right"/></a>{/if}
{if $entry->content}{eval var=$entry->content}{/if}</p>
</div>
</div>
</div>
{/foreach}
</div>
This is the one I put in a Global Content Block that generates tabbed content:
<div aria-multiselectable="true" role="tablist" id="accordion" class="panel-group marginbottom30">
{assign var='count' value='1'}
{foreach from=$cgsimple->get_children($page_alias, true, $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="#accordion" 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=$cgsimple->get_page_content($child.alias)}
</div>
</div>
</div>
{/if}
{/foreach}
</div>