[Pmwiki-users] local/Main.php...

Thomas -Balu- Walter list+pmwiki-users
Wed Jan 28 09:19:31 CST 2004


Hi guys,

first of all: great work you've done so far! I stumbled across pmwiki
yesterday and am playing with it since then. And so far it feels well
written, has exactly the features I need and is as flexible as I want it
:-)

I've found a minor thing though which I don't like (so far ;) - the way
Pmwiki loads the local configuration files.

I wanted to have a global layout for all pages, so I've edited
local.php. In addition I wanted to modify the Main-group so that it
looks a little different. But now it loads the Main.php for all other
groups too - yes, it's documented that way, but...:

"For all LocalCustomizations, PmWiki first processes the local.php file,
and then looks for a per-page customization file in the local/
subdirectory to process. If there is no per-page customization file then
PmWiki looks for a per-group customization, and if that doesn't exist it
looks for a per-group customization file for the group given by the
$DefaultGroup (usually "Main"). "

I might find a workaround for this, but first I don't like workarounds
and second I find this behaviour bad. 

IMHO local.php is the global configuration that should be used for all
groups. One should be able to override that using a page or group
specific configuration. Using local/Main.php as an additional "global
config" simply makes it impossible to override settings just for the
Main group. I'd also load the files in a different order: 
local.php -> local/Group.php -> local/Group.PageName.php
(if file_exists() && is_readable() of course ;)

This way you'd avoid having duplicate code in local/Group.PageNameX.php
as all "page configs" would share a common "group config" (plus a global
"site config").


Another that just came into my crazy mind:
Using single quotes to define strings in PHP would help a lot to
avoid escaping special characters (the only char that needs to be
escaped in single quotes is of course the single quote itself.
IIRC in XHTML you should (must?) use double quotes for the arguments.

The idea is to write e.g. 
$PageDiffFmt = "<h1><a href='\$PageUrl'>\$PageName</a> $[Revisions]</h1>";
as
$PageDiffFmt = '<h1><a href="$PageUrl">$PageName</a> $[Revisions]</h1>';

That way you don't have to escape the $, have double quotes as
arguments for the HTML tags and finally have a cleaner look IMHO.

BTW - special chars like \n will of course not work in single quotes :)


Now finally - Regards from Germany
        Thomas -Balu- Walter

PS: finally? ;) 
I've not read the total archieved discussion of the new CSS/DIV based
layout which will be used in 0.6, but may I suggest to not "overdo"
this? I usually find it easier to have a simple code that can easily be
extended instead of getting complicated code and having to understand
that first, before I cut most of it away or replace it to achieve what I
wanted.

Do just as much as needed in pmwiki.php itself to create a page using
HTTPHeaders, header (, generated content) and footer. One could then
easily extend the header/footer creation to get a more complicated
layout using external files (being delivered with the tarballs as
examples in a skin-directory e.g.)



More information about the pmwiki-users mailing list