[pmwiki-users] Problems with the embedded CSS in pmwiki.php

Hans design5 at softflow.co.uk
Mon Oct 30 16:17:32 CST 2006


Monday, October 30, 2006, 8:54:08 PM, Patrick wrote:

>  What we ultimately want is this sequence:

>     a. core PmWiki styles
>     b. recipe styles
>     c. skin styles
>     d. local/admin styles

> But since <!--HTMLHeader--> is responsible for a, b, and d, the only
> way to get skin.css in the correct location--that is, after core and
> recipe styles but before local/admin styles--is to either have the
> skin manipulate $HTMLHeaderFmt via skin.php (#2 of my earlier
> message) or for the core to define a "automatically load skin.css" 
> rule to put the skin's css file in the appropriate location (#3
> in my earlier message, the one you said you were missing something).

I just tried to create this sequence, but found that I needed to have
some core skin layout styles already loaded first, thus:

  a. skin layout styles
  b. core pmwiki styles
  c. recipe styles/admin styles via HTMLStylesFmt
  d. further skin styles (styling, colors, fonts, print styles)
  e. local.css and other localisation styles

To add all skin styling late did not work. Also a skin template may
use conditional branching to inject browser specific css, all this is
better done in the template.

To get the pmwiki-core.css file loaded at second place I had to load
it from within pmwiki.php, as outlined in a previous mail. Only that
way will it be the first inserted after HTMLHeader. So this may be an
argument for changing the default pmwiki core behaviour, and not just
leaving it to skin authors or admins.

>> Automatically generating pmwiki-core.css is
>> easy enough, so that it can be updated between PmWiki releases, and I
>> can null the embedded styles in skin.php with:
>> 
>>   global $HTMLStylesFmt;
>>   $HTMLStylesFmt['pmwiki']    = '';
>>   $HTMLStylesFmt['diff']              = '';
>>   $HTMLStylesFmt['simuledit'] = '';
>>   $HTMLStylesFmt['markup']    = '';
>>   $HTMLStylesFmt['urlapprove']= '';
>>   $HTMLStylesFmt['vardoc']    = '';
>>   $HTMLStylesFmt['wikistyles']= '';

> Hmm, I didn't quite realize there were seven sets of things to
> be nulled out (I knew there were a few, but didn't know that
> this many existed).  I might be able to come up with a shortcut
> for this.

Perhaps all of these styles could be included in a pmwiki-core.css
file. Even though some are only needed occasionally.

> And as I indicated in my previous message to Hans, I don't have a 
> problem with the distribution including a pmwiki-core.css file 
> that skins can use (and that will be kept up-to-date), I only have 
> a problem with breaking existing sites if we start automatically
> including that file by default.

I fully understand your concern about breaking existing sites, as you
also detailed in your previous post. And I am not in a position to
judge how big a problem this may be. It may be good to hear from
others about how how much of a problem it may be for them.

To have a pmwiki-core.css file included will be a great help.
How to have it loaded at place b (on my list above) without it being
done from pmwiki.php I don't know.

And if loading it from pmwiki.php
via HTMLHeaderFmt is the best way to load it early, then we are left
with an upgrade problem with some possible problems for existing
sites, I agree. But perhaps not such a big problem, or less then the
skins breaking now when upgrading to 2.2.0 without upgrading the
skins, because of relative page variables (different issue I know!).

But I think it is worth it in the long run, even if it is too much
hassle now :)


Hans





More information about the pmwiki-users mailing list