hey all,

I have dilemna...

I have javascript arrays that are created by the
toolkit as I reiterate thru foreach loops..

anyways, after much coding on the js end to do some
ridiculous things (complicated)....I started getting
errors because the dynamic content generated by the
toolkit from some hashes isn't consistent..sooooo,
many of my js arrays are formatted wrong with 'commas'
and such out of wack...to try and code template
toolkit to make amends for every situation in which my
js arrays won't muck up is too much..SOOOOOOO,

I decided to create ARRAYS in toolkit, and after they
are occupied...foreach thru them to create my js
arrays...one problem...since what is returned from the
backend is dynamic, I can't "pre-initiate" these
arrays..ala.

[% somearray=[] %]

thru each foreach loop..I need to create a "new"
dynamic array that I can reference later to populate
the js arrays...I figure something like this..

[% i=0 %]
[% FOREACH y=somevalues %]
  [% FOREACH x = y.prices %]
     [% dynamicarray.$i.push('x.id') %]
[% END %]
[% i=i+1 %]
[% END %]

I guess if it reiterated thru 3 times, the outer
foreach loop.....then, I would have "3" dynamically
created arrays in template toolkit...

dynamicarray1 = []
dynamicarray2 = []
dynamicarray3 = []

and each would have some "id's" that pushed into
them..this way I can reiterate thru them..

the questiion is..how can I do this, and once I have
them, how can I effectively reiterate thru them to
create the js arrays like so...

var 2d_jsarray = new Array(
[% FOREACH totaldynarrays %]
new Array(
[% FOREACH darray=dynamicarray1 %]
  '[% darray %]'[% UNLESS loop.last %],[% END %]
[% END %]
}[% UNLESS loop.last %],[% END %]
[% END %]
);

so, the final outcome would be..

var 2d_jsarray = new Array(new
Array('val1','val2','val3'),new
Array('etc','etc','etc'),new
Array('etc','etc','etc'));


I can do this in template toolkit WITHOUT first
putting them into toolkit arrays, just putting them
right into the js 2dimension array, but again...too
much conflict..

any ideas???

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.ourshack.com/mailman/listinfo/templates

Reply via email to