[pmwiki-users] Using variable in skin template

Sandy sandy at onebit.ca
Sat Oct 24 10:34:30 CDT 2009


DaveG wrote:
> 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.

That makes sense. The more I look beneath the hood, the more I'm 
impressed with how well things are laid out. No $500 labour bills to 
reach one faulty wire.

>> 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.

Good idea. I remember doing that in a tutorial, way back when. (I'm a 
binge user. A week or two intense, then forget everything over the next 
six months.) Doesn't help that I've dabbled in 6 very different 
languages over the last 25 years. Let me count the different print 
formats,...


>> 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.


What's up with the two quotation marks? I remember something about " not 
being the same as ', something about one being literal and the other 
interpretting the variable names, but google is being dense.

Sandy








More information about the pmwiki-users mailing list