[pmwiki-users] css dir

Patrick R. Michaud pmichaud at pobox.com
Wed Sep 13 17:25:36 CDT 2006


On Wed, Sep 13, 2006 at 02:17:36PM -0400, Henrik Bechmann wrote:
> Patrick R. Michaud wrote:
> >I'm a little confused -- you say that the *skin's* css is being
> >put into pub/css/Home.FrontPage.css ?  Why not have the skin's css
> >in the skin directory, as opposed to using the per-page .css
> >file in pub/css/ ?
>
> My aim here is to conform to PmWiki standards and practices (and in the 
> process discover what they are<grin>). So I wanted to cluster the skin 
> files in the prescribed way, with a minimal amount of code in the template.
> 
> Indeed I had expected to find that if I put myskin.tmpl, myskin.php, and 
> myskin.css into a skin directory pub/skins/myskin, and set 
> $Skin='myskin', all the files would get picked up automatically. The 
> myskin.tmpl and myskin.php do, but myskin.css doesn't (version 2.1.26).

Ah, I see.  No, PmWiki doesn't automatically pick up any .css files
from out of the skin directory; it never really occurred to me that 
perhaps it should do that.  :-)

But I'm pretty sure it's better if we let the skin's template (.tmpl)
file control the loading of any .css files.  This lets the template
control the order in which .css files are loaded, as well as making
it easy to have some .css files be "optional" (several skins do this
already).

So, the "prescribed way" is to use a <link .../> tag in the template:

    <link rel='stylesheet' href='$SkinDirUrl/myskin.css' type='text/css' />

> For one thing, the pub/skins/myskin/myskin.css option isn't mentioned in 
> the section "CSS Files: Controlling Page Style" at 
> http://www.pmwiki.org/wiki/Cookbook/SkinGuidelines.

You're correct, that section definitely needs an update
(and possibly the page could use some rewriting).

> Placing MyGroup.MyPage.css in the field's pub/css/ directory is the only 
> configuration I could find that gets the skin file picked up automatically.

And it only gets picked up for MyGroup.MyPage.  Other pages won't
pick it up.

> [...] not what I expected, as the requirement for an explicit 
> link for the css file seems inconsistent with the auto-load of the other 
> two files.

A valid point that hadn't occurred to me.  I've always thought of 
the .css files as being like .gif images or other graphics that go 
in the skin's directory, in that they get loaded only when (and where) 
specified by the template file.

Pm




More information about the pmwiki-users mailing list