Closed cheekyboots closed 12 years ago
Hi, Yeah you have to escape special strings like URLs in the less way. Set your string literal variables like this:
$vars['myvar'] = '~"http://example.com"';
Did this work for you?
Yes it did! Thank you so much. I really appreciate you getting back to me so fast.
I think I'm having a related issue. I can't generate a value in "less_vars" filter that would match isurl() guard. Mixin is pretty simple:
.background (@url) when (isurl(@url)) {
background: url(@url) no-repeat center top;
}
But no "url(something)" string generated in PHP (quoted, unquoted, using ~, I've tried all) wants to match that guard. Actually, I wasn't even able to succeed passing url(something) directly from within my LESS, skipping PHP altogether. Maybe a lessphp bug?
So right now what I'm doing is using isstring(@url) guard instead, and setting a default value of "false" in PHP. That works. But I'd like to know what's happening with isurl().
I am trying to set LESS variables from PHP using the example provided.
This works: $vars[ 'foo' ] = "red";
This doesn't - the only thing that comes through is the string "http": $vars[ 'headerImg' ] = "http://mysite.dev/wp-content/themes/blah/images/blah.png";
Any ideas?