By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

3 dimensional array assigned to smarty pass to javascript

P: 1
In my program I want to use a 3 dimensional array to read out and compare the url data. That doesn't matter, but the main thing is, i pass a 3 dimensional array to a template as {test} so it has the following array structure a numeric array, where i pot a associative array in, and there inside is a another numeric array.

$test[0]['name'][0]

Now I want to use javascript to read out the length of the different array's and also the variables but since I cant get it work, can someone help my please? i ll be greatfull
Mar 8 '12 #1
Share this Question
Share on Google+
1 Reply


dlite922
Expert 100+
P: 1,584
Because of smarty's default curly bracket ({}) tags, you need to use the smarty {literal} tag to echo out your variable value to a javascript one. Remember javaScript is client side, server does not execute it like smarty and php, the user's computer browser executes it.

You can also print it out to a hidden field and read it using javascript. document.getElementById('hiddenFieldsID').value. or using jquery: $('#hiddenFieldID').val()

Good luck,

Dan
Mar 16 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.