[pmwiki-users] Can't use $SkinDirUrl in $HTMLStylesFmt[] ?

Petko Yotov 5ko at 5ko.fr
Fri Jun 24 05:40:39 CDT 2011


On Friday 24 June 2011 12:26:39, Oliver Betz wrote :
> Petko Yotov wrote:
> >> is it correct that $SkinDirUrl isn't set early enough to be used in in
> >> $HTMLStylesFmt[]?
> >
> >Yes, but you can escape the $ with \$ inside double quotes:
> so it evaluates later?

Yes, before the skin is printed.

> 
> >  $HTMLStylesFmt['my-menu'] = "<link rel='stylesheet'
> >  
> >   href='\$SkinDirUrl/menu.css' type='text/css' />";
> >
> >Inside single quotes, no need to use \$.
> 
> Thanks for the clarification. Being rather PHP-ignorant, I thought
> that the type of the inner quotes is relevant.

It's the *outer* quotes (which wrap the whole string), not the inner quotes 
parts of the string. Inside 'single' outer quotes, $variables are not expanded 
and need not to be escaped; inside "double" outer quotes variables are 
expanded (replaced with their values) if the $ is not escaped by \$.

  http://php.net/manual/en/language.types.string.php

Petko



More information about the pmwiki-users mailing list