[pmwiki-users] Using variable in skin template

DaveG pmwiki at solidgone.com
Fri Oct 23 21:54:43 CDT 2009


Sandy wrote:
> I'm not (yet) comfortable with $HTMLStylesFmt[]. 
It's an array, which can contain arrays :) Usually you index the array 
with the name of the skin, but any name (or even no name) will work 
fine. The content of the array is output at the point in the .tmpl file 
where the <!--HTMLHeader--> tag appears.

> For that matter, arrays 
> in php still confuse me. Perfectly clear while I'm reading the 
> tutorials,... A matter of practice.
Easiest way to learn is to print the content of the array. it's not 
clean and might cause some errors, so only do this on a dev environment, 
but simply add this to a skin.php file:
   print_r($HTMLStylesFmt);

Then view the source of the web page to see the content of the array.


> Thinking further, can this go in skin.php?
> $color1 = '#00cc00';
> That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].
Well in order to use the variable from within the template you'd need 
use $FmtPV:
   $FmtPV['$color1']='"#00cc00"';

So then you could use it in .tmpl (not in .css files though). Personally 
I prefer to use $HTMLStylesFmt.


  ~ ~ David



More information about the pmwiki-users mailing list