Jump to content

How to get variable from *.php file?


KenFranklin

Recommended Posts

below are 2 ways to accomplish this, but I would suggest #1

 

1) create a tpl file and use the addJsDef or addJsDefL function.  you can review the product.tpl file in the default theme for examples

2) parse the javascript file through the smarty engine as though it was a smarty template.  then return the javascript inline

Link to comment
Share on other sites

  • 11 months later...

Don't know if someone is still looking for the answer personnally I use this method

1)Assign your variable

$this->context->smarty->assign('var', $yourphpvar);

2) Use addJsDef

Media::addJsDef(array('thejsvarname'=>$yourphpvar);

It work on both 1.6 on 1.7 prestashop version

Link to comment
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
×
×
  • Create New...