Szpadyzor Posted May 19, 2015 Share Posted May 19, 2015 (edited) Hello. I'am working on my own module. I want to put content of my js script into head. I've created hook hookDisplayHeader(). There i put another method which calls: $this->context->controller->addCSS(); $this->context->controller->addJS(); Next i'am putting between addCSS() and addJS(): $this->smarty->assign('returning value form method') and $this->display(__FILE__, 'myTPLfile.tpl') which contain: <script type="text/javascript"> var data = {$returning value form method}; </script> Everythink goes good, CSS and JS (calling from context) are adding correct, but this js script in tpl file is putting on the top of the site, before <html>. How can i put it into <head> that returned my js script? I want it after addCSS and before addJS. If it is in bad section please move it to another. Edited May 19, 2015 by Szpadyzor (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted May 19, 2015 Share Posted May 19, 2015 Add a javascript file, something.js, and create it like (without script tags): var data = {$returning value form method}; Link to comment Share on other sites More sharing options...
Szpadyzor Posted May 19, 2015 Author Share Posted May 19, 2015 (edited) I think i cant do this beacause there are informations which are storing in session, it will be connected with another www and it could shows session data of someone else... Edited May 19, 2015 by Szpadyzor (see edit history) Link to comment Share on other sites More sharing options...
Szpadyzor Posted May 28, 2015 Author Share Posted May 28, 2015 Anyone can help? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now