JoelWebsites Posted April 14, 2015 Share Posted April 14, 2015 Is it possible to set variables for .css files just like we set variables for .tpl files? If anyone knows how to get this done please let me know thank you. Link to comment Share on other sites More sharing options...
selectshop.at Posted April 14, 2015 Share Posted April 14, 2015 Mainly yes See some tutorials samples on the net: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables http://www.w3.org/TR/css-variables/ Prestashop is already using SASS in his templates http://sass-lang.com/#variables 1 Link to comment Share on other sites More sharing options...
bellini13 Posted April 15, 2015 Share Posted April 15, 2015 When you say variables like .tpl files, do you mean using the smarty engine to define name/value pairs and have the CSS processed through the smarty engine? Link to comment Share on other sites More sharing options...
selectshop.at Posted April 16, 2015 Share Posted April 16, 2015 (edited) @JoelWebsites - Here I found a good tutorial comparing LESS and SASS. Prestashop already integrated SASS, we hope that this will be good for the software. I'm seeing several designers saying that LESS is better. Boths manage css variables and classes on a given library. EDIT: I forgot to mention that there is a third one - Stylus. SASS is the oldest one of css stylesheet langugaes LESS (Apache) SASS (OS independent) Stylus (cross platform) Edited April 16, 2015 by selectshop.at (see edit history) 1 Link to comment Share on other sites More sharing options...
JoelWebsites Posted April 23, 2015 Author Share Posted April 23, 2015 (edited) What i did was i copied my .css code inside the header.tpl inside <script> tags ..so now the css is working as well as i will be include the variable.. I got the variables set my using this code in hookHeader() { $smarty = $this->context->smarty; $smarty->assign(array('id_supplier' =>"JOEL", 'JOEL' =>"Fernandes", 'password' =>"123", )); } So now {$JOEL} is global variable that can be used in all the .tpl files Edited April 24, 2015 by JoelWebsites (see edit history) Link to comment Share on other sites More sharing options...
selectshop.at Posted April 24, 2015 Share Posted April 24, 2015 This is a possibility too, but restricted only to the theme in use. You can also add JS by the same way, not only css. Link to comment Share on other sites More sharing options...
JoelWebsites Posted April 24, 2015 Author Share Posted April 24, 2015 I got the variables set my using this code in hookHeader() in my module { $smarty = $this->context->smarty; $smarty->assign(array('id_supplier' =>"JOEL", 'JOEL' =>"Fernandes", 'password' =>"123", )); you will need to return $this->display(__FILE__, 'header.tpl'); inside public function hookdisplayHeader($params) incase you want to do it for a module.. } 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