Jump to content

javascript in smarty


sbarrett
 Share

Recommended Posts

Hello guys I ask a help:

I'm editing the file form.tpl

I have a javascript function like:

 

 

 



function letturaxls(nomefile){

var nomexls = nomefile.split(".xls");
var nome_xls=nomexls[0];
//alert (nome_xls);
//{$nxls='ciccio'};
{$nxls=nome_xls};

var xls_ordini={ordine xlss=$nxls};

for (var i =1;i<=4;i++){

addProduct_pr(xls_ordini[0][i],xls_ordini[1][i]);

}

}


I am trying to assign the variable nome_xls javascript at the variable smarty $nxls.

i do not know how to do ..

was easy if it was {$nxls = 'ciccio'};

how should I do? :(

Share this post


Link to post
Share on other sites

What exactly do you want to do?

 

Smarty code is being executed before the page is generated and sent to the browser, while javascript code is executed after the page is received by the browser.

 

So you cannot mix the 2 of them, other than generating js script from Smarty code.

You cannot for example call a Smarty variable from a javascript piece of code.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More