[pmwiki-users] Field local CSS customization
marc
gmane at auxbuss.com
Thu Nov 2 07:43:51 CST 2006
Patrick R. Michaud said...
> On Wed, Nov 01, 2006 at 05:16:28PM -0000, marc wrote:
> > I use:
> >
> > $PageCSSListFmt = array(
> > '$FarmD/pub/css/local.css' => $FarmPubDirUrl/css/local.css',
> > '$FarmD/pub/css/$Group.css' => '$FarmPubDirUrl/css/$Group.css',
> > '$FarmD/pub/css/$FullName.css' => '$FarmPubDirUrl/css/
> > $FullName.css');
> >
> > but this does not work for field customizations.
> >
> > The doc's description of $PageCSSListFmt says
> >
> > If you wish to be able to place css configuration files in both the
> > field's pub directory, and the farm's pub directory, you may want to
> > add these lines to your local/config.php file (as described in
> > Cookbook:SharedPages):
> >
> > $PageCSSListFmt = array(
> > '$FarmD/pub/css/local.css' => '$FarmPubDirUrl/css/local.css',
> > '$FarmD/pub/css/$Group.css' => '$FarmPubDirUrl/css/$Group.css',
> > '$FarmD/pub/css/$FullName.css' => '$FarmPubDirUrl/css/
> > $FullName.css',
> > 'pub/css/local.css' => '$PubDirUrl/css/local.css',
> > 'pub/css/$Group.css' => '$PubDirUrl/css/$Group.css',
> > 'pub/css/$FullName.css' => '$PubDirUrl/css/$FullName.css');
> >
> > but the last three lines don't generate <link>s to the field's local
> > files, but will recognise that local files exist then point to files in
> > $PubDirUrl.
> > [...]
> > Am I doing something wrong or is there a simple method to do this?
>
> Each field should have its own pub/ directory, which generally should
> be in the same location as the field's wiki.d/ directory.
Yes, that's my setup.
> Since
> pmwiki.php always executes from the field's directory, using
> 'pub/css/local.css' will find the field's local.css instead of the
> farm's local.css (which would be in $FarmD/pub/css/local.css).
Yes. PmWiki finds these, since it generates <link>s, but to $PubDirUrl
(or /pmwiki/pub) and not to /pmwiki/field/pub.
> To help further I'd probably need to know the directory structure
> you've settled on for your farm installation. Here's a guide
> to what PmWiki normally expects:
>
> public_html/
> pmwiki/ # farm directory
> pmwiki.php
> local/
> farmconfig.php # farm's config
> scripts/
> wikilib.d/
> pub/
> css/
> guiedit/
> skins/
>
> field1/ # field directory
> index.php # include_once('/.../public_html/pmwiki/pmwiki.php')
> local/
> config.php # field's configuration
> wiki.d/ # field's pages
> pub/
> css/ # per-field css files
Okay, I have
pmwiki/
pmwiki.php
field/
I'm not wedded to this. The reason I'm coming up with these
"structural" questions at the moment is that I am revisiting the
fundamentals now that I know a bit more - at least I think I do - than
when I set things up; things that determined where I am now.
Anyway, I moved a field to the structure you recommend:
pmwiki/
pmwiki.php
field/
and after a few edits all was well, but the same symptoms occur. Namely
that the <link>s are generated, but the URLs point to pmwiki/pub/css/
> Thus, when someone access the field wiki via field1/index.php,
> index.php calls pmwiki.php in the farm's directory. The pmwiki.php
> script sets $FarmD to be '/.../public_html/pmwiki'. Thus, the
> two directories for public files are "$FarmD/pub" for the farm
> and "pub" for the field.
Okay, thus "$FarmD/pub" has the URL variable "$FarmPubDirUrl", but what
is the URL variable for "pub" (= field/pub)? Given that
$PubDirUrl = 'http://.../pmwiki/pub';
and
$FarmPubDirUrl defaults to $PubDirUrl
> The farmconfig.php file needs to set $FarmPubDirUrl to be '/pmwiki/pub',
> since PmWiki can't figure out the url automatically. However,
> PmWiki can figure out the field's pub directory from the url, and
> will set $PubDirUrl to '/field1/pub'.
Ah! Setting $FarmPubDirUrl didn't do it - on its own - but unsetting
(commenting out) $PubDirUrl did.
So, is the correct course of action - for a farm - to set $FarmPubDirUrl
and not set $PubDirUrl? That's not how I read the docs.
> Thus, to look at just two entries in $PageCSSListFmt:
>
> '$FarmD/pub/css/local.css' => '$FarmPubDirUrl/css/local.css',
> ...
> 'pub/css/local.css' => '$PubDirUrl/css/local.css',
>
> For the first entry, PmWiki will look for a file at
> /.../public_html/pmwiki/pub/css/local.css, and if it finds one
> it will generate a stylesheet link to /pmwiki/pub/css/local.css .
>
> For the second entry, PmWiki will look for a file at
> pub/css/local.css (relative to the field1/ directory), and
> if it finds one it will generate a stylesheet link to
> /field1/pub/css/local.css .
Yes, it was this last case that wasn't working, but commencing
farmconfig.php with:
<?php if (!defined('PmWiki')) exit();
# $PubDirUrl = 'http://.../pmwiki/pub';
$FarmPubDirUrl = 'http://.../pmwiki/pub'; # defaults to $PubDirUrl
now does what I expect. (I'll carry on trying to break it for a bit,
though.)
Thanks a lot for this.
--
Best,
Marc
More information about the pmwiki-users
mailing list