[pmwiki-users] Using variable in skin template

Sandy sandy at onebit.ca
Sat Oct 24 10:59:41 CDT 2009


Hans wrote:
> Friday, October 23, 2009, 11:14:24 PM, Sandy wrote:
> 
>> Thinking further, can this go in skin.php?
>> $color1 = '#00cc00';
>> That keeps all the skin stuff in the skin, and avoids $HTMLStylesFmt[].
> 
> why don't you just set the color attributes in
> the skin's css file? after all, the purpose of the
> css file is to have one location for changing atributes
> site-wide. There is realy no need to set a color attribute
> via a php variable, unles one wants to dynamically
> manipulate it, say by using value sset in a wiki page.
> 
> 
>   ~Hans

The current site uses only one set of colours, so it's easier to keep 
them in the <style> tag and only deal with one file. I've used separate 
css files before, but it's overkill for this one.

The reason I want a variable is if I use #006600 for several different 
elements (H#, A, HR, various borders) then want to try #007700, I have 
to change each and every occurence. Yes, I can use the editor's 
search-and-replace, but a variable seems more elegant. Separating it 
into a separate css file wouldn't change that.

I could do the style as
H1, H2, ... A.hover
{color:#006600;}

so the color number occurs only once, but I suspect there's a reason 
I've never seen a file done that way.

Now to stop chatting and start experimenting.

Thanks,

Sandy




More information about the pmwiki-users mailing list