[pmwiki-users] Problems with the embedded CSS in pmwiki.php
marc
gmane at auxbuss.com
Mon Oct 30 13:52:29 CST 2006
Patrick R. Michaud said...
> On Mon, Oct 30, 2006 at 12:20:51PM -0000, marc wrote:
> > Hans said...
> > > Sunday, October 29, 2006, 6:21:22 PM, marc wrote:
> > > [...]
> > > The skin designer would add an extra line in the template
> > > to facilitate loading of this pmwiki-core.css file.
> >
> > I suspect that this CSS file would be loaded by default - so as not to
> > break the default install [where it would be loaded in any case, in your
> > scenario] and not to break any existing skins.
>
> Having the CSS file "loaded by default" doesn't at all resolve the
> original issue that started this thread. The only ways that a
> pmwiki-core.css file can achieve the desired semantics (admin
> overrides skin overrides core) is by one of the following:
>
> - All templates explicitly load pmwiki-core.css at an appropriate location.
>
> - The skin has a skin.php file that manipulates $HTMLHeaderFmt.
>
> - We define an "automatically loaded skin.css" rule that adds
> a link to a per-skin css file between the pmwiki core CSS and
> any site-specific (local) CSS files.
>
> Currently PmWiki goes with the second option.
I understand #1 and #2, and why #1 is undesirable as things stand. I'm
clearly missing something with understanding #3. I thought that since
existing skins already include <!--HTMLHeader-->, then this could be
used to trigger the generation of the <link rel='stylesheet' for
pmwiki-core.css - in other words, a replacement for the embedded PmWiki
core styles.
Wouldn't something like this work (I know it doesn't, as is, but I'm
sure you see where I'm going):
if ($var == 'HTMLHeader' || $var == 'XMLHeader')
$TmplFmt[$ps][] = "<link rel='stylesheet' type='text/css'
href='$PubDirUrl/css/pmwiki-core.css' />";
$TmplFmt[$ps][] = &$HTMLHeaderFmt;
> > > We could move towards a standard pmwiki-core.css file already now, by
> > > pmwiki providing one in pub/css/
> >
> > This is possible now, but Patrick is the oracle on the repercussions
> > that pass over us mortals ;-)
>
> The problem is that transitioning the universe of existing PmWiki
> installations and skins to exclusively use a standard pmwiki-core.css
> file is likely to be a hassle at this point, and I'm not sure it's
> worth the hassle. Even if we provide pmwiki-core.css, skins will
> *still* have to use something to manipulate $HTMLHeaderFmt and/or
> $HTMLStylesFmt, so I'm not sure we're saving anything. (Either that
> or we do some deep magic in analyzing skin templates to decide that
> the core styles are already being included by the template.)
No problem, thanks for looking into it Patrick. I can work around it for
now without branching the core, thankfully, since it is clearly not a
requirement for many others. 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']= '';
And for now skin.tmpl can contain:
<link rel='stylesheet' type='text/css' href='$PubDirUrl/css/pmwiki-
core.css' />
<!--HTMLHeader-->
</head>
since no-one else is involved, and avoids hacking skins.php. Although I
have a feeling that the temptation to finish the job is too strong :-)
Thanks again. It's a testament to your design that we can flex PmWiki to
this extent. It's really quite remarkable.
--
Best,
Marc
More information about the pmwiki-users
mailing list