[pmwiki-users] style sheets order from a directive function

Petko Yotov 5ko at 5ko.fr
Sat Jan 16 06:36:40 CST 2010


On Friday 15 January 2010 23:48:13, V.Krishn wrote :
> Setting $HTMLHeaderFmt['myrecipe'] = 'value'
> from within directive function results in being set after user defined css
> like local.css..etc.
> 
> I am thinking of using
> $array2['styles'] = $HTMLHeaderFmt['styles'];
> $array2['infobox'] = "link to css";
> $HTMLHeaderFmt = array_merge($array2, $HTMLHeaderFmt);
> 
> I hope this would be ok?
> I would suggest if pmwiki calls the user defined styles to be loaded at the
> end of execution or can this presently be done by changing some variable?
> 

Normally, a recipe would place directly the CSS in a variable like this:
  $HTMLStylesFmt['myrecipe'] = 'a.ext {color:green;}'; # [1]

And not in $HTMLHeaderFmt.

This should place the new CSS before local CSS files loaded from pub/css, and 
a wiki could override these locally.

Even better, your recipe could define your styles with SDVA() :
  SDVA($HTMLStylesFmt, array('myrecipe'=>'a.ext {color:green;}'));

(SDVA = Set Default value in array, unless the value is defined.)

This way, an admin could replace the recipe's CSS via a line like [1] above in 
config.php.

Petko



More information about the pmwiki-users mailing list