[pmwiki-users] Field local CSS customization
Patrick R. Michaud
pmichaud at pobox.com
Wed Nov 1 14:22:54 CST 2006
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. 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).
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
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.
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'.
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 .
Hope this helps,
Pm
More information about the pmwiki-users
mailing list