Roope Posted December 19, 2013 Share Posted December 19, 2013 Hi all! I came across to strange issue today. I was testing the oyejorges Less.php class to parse my less assets and noticed that when I use it on PW template the output of class changes. When you use less percentage() function, on PW decimal mark changes from point to comma. I've been using oyejorges Less.php class for some time now on different php apps and haven't noticed this kind of behaviour before. I'm totally lost here - where is it comming from and is it because of PW or Less.php? Any help is much appreciated! https://github.com/oyejorge/less.php/search?q=percentage&ref=cmdform https://github.com/oyejorge/less.php/search?q=Less_Tree_Dimension&ref=cmdform My RTC details - code on php file outside PW and on PW template. template: <?php require 'site/modules/less/Less.php'; // test.php require '../modules/less/Less.php'; // site/templates/home.php $less = new Less_Parser(); $less->parse(" div { value: percentage(12.3 / 14.5); } "); echo $less->getCss(); ?> output: div { value: 84.82758620689656%; } // test.php div { value: 84,82758620689656%; } // site/templates/home.php Link to comment Share on other sites More sharing options...
Wanze Posted December 19, 2013 Share Posted December 19, 2013 What are the language settings of ProcessWire? My guess is that maybe the locale is set different from PHP when you execute the Less script inside Pw templates. See : http://www.php.net/manual/en/function.setlocale.php 2 Link to comment Share on other sites More sharing options...
Roope Posted December 19, 2013 Author Share Posted December 19, 2013 (edited) Thanks Wanze! Lighting fast response and perfect answer! This is multilingual site and I had finnish language by default for admin user so change back to english corrected output. You rock! But now this leads to another question. I don't want my css output change for user language. It has to be same all the time or it's not valid. How can I prevent this change? EDIT: ..or that makes me wonder isn't this more of a issue at oyejorges less class since it should worry about generating valid css and not to rely on any php locale settings.. Edited December 19, 2013 by Roope 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