Hi
I am trying to pass the values of a smarty loop into a javascript array. I suspect I may have to first pass the values to a Smarty array and then assign that to the javascript array but I am unsure how to declare a smarty variable as an array. This has to happen in a template because I am using smarty to dig out the data. i.e.
var data = new Array();
{foreach from=$cgsimple->get_children('$page_alias','0') item='child'}
{assign var='smarty_data' value=$cgsimple->get_page_content($child.alias,'Photo_Name')}
data = {$smarty_data};
{/foreach}
{literal}
// the values of the javascript array data are used in the function below
window.addEvent('domready', function() {
var myShow = new Slideshow.KenBurns('show', data, { captions: true, controller: true, delay: 4000, duration: 2000, height: 515, hu: '/uploads/filepath/', width: 774 });
})
{/literal}
So instead of having data = {$smarty_data}; in the loop I presume I need to use a Smarty arry to capture the data and then pass it to the javascript data array after the loop has finished.
All and any help much appreciated.
How to set up a smarty array in a template?
How to set up a smarty array in a template?
Last edited by applejack on Thu Aug 21, 2008 9:11 pm, edited 1 time in total.
- chuckienorton
- Forum Members
- Posts: 68
- Joined: Wed Feb 14, 2007 6:58 pm
- Location: Pasadena, California
Re: How to set up a smarty array in a template?
I'm looking for the same thing. Did you ever figure it out?
~Chuck
~Chuck
Re: How to set up a smarty array in a template?
Hi see this post
http://forum.cmsmadesimple.org/index.ph ... #msg121614
What exactly are you trying to do?
http://forum.cmsmadesimple.org/index.ph ... #msg121614
What exactly are you trying to do?