Snade Posted April 26, 2013 Share Posted April 26, 2013 Hi all, I'm making a module which compiles .less file using LESSphp. If I try to include lessc.inc.php in the module php file I got bunch of errors, but if I run a separate file it all works good. So I got compile.php with this content: <?php require "lessc.inc.php"; $less = new lessc; echo $less->compileFile("cleantheme.less", "cleantheme.css"); ?> (if you have an idea how I can run this inside the module php file within class ModuleName extends Module{ , it will be great I guess) If I run this script using normal link it all works good, new page is opened and the .less file is compiled <a target="_blank" href="'.$domain.__PS_BASE_URI__.'modules/themeeditor/compile.php">'.$this->l('Compile File').'</a> The question is, How can I run this file without opening new window using AJAX ? I tried this (and many variations of it) without success: this is very basic version just to see what I was trying to get working, but not sure if I'm on the right direction <script type="text/javascript"> $(document).ready(function() { $(#subbtn).click(function() { $.ajax({ url: "'.$this->_path.'compile.php" }); }); }); </script> Any help will be really appreciated Link to comment Share on other sites More sharing options...
prestashopninja Posted April 27, 2013 Share Posted April 27, 2013 Hello, If I try to include lessc.inc.php in the module php file I got bunch of errors, but if I run a separate file it all works good. Perhaps you missed out something there. Just out of curiosity, I coded a simple module with lessphp 0.3.9 and it works out of the box. Please find it attached. Also, remember to set the proper permissions to let apache user write into the module directory [PS/modules/less] as it will write the css output to a file there. I hope this helps. less.zip Link to comment Share on other sites More sharing options...
Snade Posted April 29, 2013 Author Share Posted April 29, 2013 (edited) Thank you very much my friend I think my problem was that I did not include the less.inc.php in the construct ... dunno why I made this mistake... Thanks again for spending time to make this module, that was really helpful. I have one more question, is there a way to make the .css file that is hooked in the head, to be always the last .css file ? even if I put my module on the last position in the back office, the css file is not the last one... Edited April 29, 2013 by Snade (see edit history) Link to comment Share on other sites More sharing options...
prestashopninja Posted April 30, 2013 Share Posted April 30, 2013 As far as I know, there is no built-in method to load CSS files in particular order, however this topic might help: http://www.prestashop.com/forums/topic/207770-load-css-last/ 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