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

Petko Yotov 5ko at 5ko.fr
Sat Jan 16 15:21:10 CST 2010


On Saturday 16 January 2010 20:46:47, V.Krishn wrote :
> On Sunday 17 Jan 2010 12:10:23 am you wrote:
> > On Saturday 16 January 2010 17:50:58, V.Krishn wrote :
> > > Here I would like to load
> > >
> > > <!--infoboxLibFmt-->
> > > <link rel='stylesheet' type='text/css'
> > > href='/pub/apps/pmwiki/cookbook/infobox/infobox.css' />
> > > .....
> > > Before the line
> > > <link rel='stylesheet' type='text/css'
> > > href='http://insteps.net/pr/a/pmwiki/pub/css/local.css' />
> >
> > Right, a custom header $HTMLHeaderFmt['recipe'] appears in some cases
> > before, in some cases after local.css. I am not sure why.
...
> I hoped if pmwiki calls the user defined styles to be loaded at the
> end of execution? The idea of having local.css is for overriding syles
>  called before.

I see. Local css files are appended at the end of $HTMLHeaderFmt in skins.php.

When a recipe is included from config.php (that's before skins.php), and adds 
$HTMLHeaderFmt entries immediately, and they appear before local.css.

If a recipe adds headers from inside a function called by Markup(), these 
headers will also be appended to the end of $HTMLHeaderFmt, but that happens 
after skins.php, so they appear after local.css.

Technically, we could move the snippet appending local.css inside the function 
LoadPageTemplate() just before printing the skin, but then recipes will not be 
able to modify these entries anymore. I'm not even sure there are any such 
recipes around. I'll think about it.

Petko

> > There are two workarounds. First is to @import the external stylesheet
> > from the inline css, like this [1] :
> >   SDVA($HTMLStylesFmt, array('myrecipe'=>'@import
> > "/path/to/style.css";'));
> 
> I would not go for this method for various implementation reasons...
> 
> > Second workaround is to force your HTML header at the beginning of the
> > array, before all other entries :
> >   array_unshift($HTMLHeaderFmt, array('myrecipe' => "<link rel=.../>"));



More information about the pmwiki-users mailing list