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

Hans design5 at softflow.co.uk
Mon Oct 30 13:30:14 CST 2006


Monday, October 30, 2006, 6:52:14 PM, Patrick wrote:

>> With this second option I do not see that it is up to the skin.php to
>> load a pmwiki-core.css file. It could just as well be loaded from
>> pmwiki.php with a $HTMLHeaderFmt['pmwiki-core'] definition. This will
>> load at the beginning of HTMlHeader, leaving admin/local
>> customisations etc to override styles if needed. A skin can still load
>> a css file later.

> ... but then how does the admin override the skin's customizations?

Just like now. If pmwiki adds the pmwiki-core.css in pmwiki.php with

  $HTMLHeaderFmt['pmwiki-core'] = "
    <link rel='stylesheet' href='\$FarmPubDirUrl/css/pmwiki-core.css' type='text/css' />\n";

replacing $HTMLStylesFmt['pmwiki'], then it will be loaded first thing
in HTMLHeader, and all HTMLStylesFmt definitions come later, and the
pub/css/local.css etc local css customisations even later.


> If you're saying to eliminate the current $HTMLStylesFmt settings
> that set the core styles, then this will break any existing skins 
> that depend on a statement like

>     $HTMLStylesFmt['pmwiki'] = '';

> to eliminate the core styles.

If $HTMLStylesFmt['pmwiki'] does not exist any more then
$HTMLStylesFmt['pmwiki'] = ''; does no harm either.

> Suppose Alice has an existing skin that doesn't want any of the PmWiki
> core styles.  In order to get rid of those, Alice has put the following
> in her skin.php file:
> 
>     global $HTMLStylesFmt;
>     $HTMLStylesFmt['pmwiki'] = '';
> 
> If we now change PmWiki's default setting so that it uses
> $HTMLHeaderFmt to set its core styles instead of $HTMLStylesFmt,
> as in:
> 
>     $HTMLHeaderFmt['pmwiki-core'] = "<link ... />";
> 
> Then when Alice upgrades her version of PmWiki, her skin
> will no longer display properly because the PmWiki core styles
> are being inserted back into her skin.  The $HTMLStylesFmt['pmwiki']
> setting she had been previously using to suppress this 
> behavior no longer has the desired effect.

True. But $HTMLStylesFmt['pmwiki'] = ''; was chiefly done to avoid the
insertion of <Styles>...</Styles> into each page head, or at least
reduce these. The styles would have been replaced in a css file, which
will be loaded later than the pmwiki-core.css file, thus overriding
these settings. So I don't expect it will be a great issue.

And any skin designer going to the trouble of eliminating the pmwiki
styles with $HTMLStylesFmt['pmwiki'] = ''; etc. will be very happy
that there is now an actual pmwiki-core.css file, which can be easily
replaced.


> If I understood correctly, your proposal was that a skin designer
> would use the following in a template file:

>     <link rel='stylesheet'
> href='$FarmPubDirUrl/css/pmwiki-core.css' type='text/css' />
>     <link rel='stylesheet' href='$SkinDirUrl/skin.css' type='text/css' />
>     <!--HTMLHeaderFmt-->

> But if PmWiki is setting $HTMLHeaderFmt['pmwiki-core'] by default, 
> then it's also necessary for the skin.php file to unset that value 
> in order to avoid having pmwiki-core.css load a second time
> (and after the skin.css).  So, the skin designer still has to
> manipulate $HTMLHeaderFmt in order to make things work properly.

As skin designer I would use in the skin template just as now:

       <link rel='stylesheet' href='$SkinDirUrl/skin.css' type='text/css' />
       <!--HTMLHeaderFmt-->

and to override any css introduced with HTMLHeader I could add a
second css file with

      <link rel='stylesheet' href='$SkinDirUrl/skin-extra.css' type='text/css' />

or in skin.php with

   $HTMLHeaderFmt['skin-extra'] = "
     <link rel='stylesheet' href='\$SkinDirUrl/css/skin-extra.css' type='text/css' />\n";

Or if I wanted to replace pmwiki-core.css with my own version:

   $HTMLHeaderFmt['pmwiki-core'] = "
     <link rel='stylesheet' href='\$SkinDirUrl/css/skin-extra.css' type='text/css' />\n";


Hans





More information about the pmwiki-users mailing list