[Pmwiki-users] "templating" or how to layout PmWiki

Patrick R. Michaud pmichaud
Fri Feb 20 10:57:39 CST 2004


On Fri, Feb 20, 2004 at 05:56:44PM +0100, Thomas -Balu- Walter wrote:
> I am one of the persons trying to get PmWiki look a lot
> different, but I had some problems in the previous version and the new
> layout is even harder to change.
> It's not really the code of the pages, but the way it is done. In fact
> the learning curve in this part of PmWiki is kinda high IMHO.

Actually, the new layout is easier to change, although I'll admit the
learning curve can be high *depending on how radically different you 
want the page to look*.

> Of course one would have to know some variables and functions too to
> access parts of the page or decide wether to display the browse-, edit-
> or print-page. 

This is actually much harder than this simple statement seems to imply.

> But to do so I could use all the power of PHP which I
> know and not having to learn the structure of the variables and arrays
> that are used now.

You can already do this.  If you want to have another PHP file totally
handle, say, the output for browsing, then just set 
$HandleBrowseFmt="file:local/skins/skin.php"; and you have full control--
PmWiki won't output anything more than what's specified in your skin.php 
file.  But keep in mind that if you do this, skin.php has to be able to
generate the appropriate DOCTYPE, output all of the HTTPHeaders to do
browser cache control and redirects (the HTTPHeaders have to be output 
before *anything* else), and then call the various output functions 
in the correct sequence to get the page to correctly output.  Plus,
not everything in $...Fmt variables are truly global variables--
$ScriptUrl, $PageUrl, $Group, and $Title change values and meaning 
depending on the name of the page being processed at the time and 
the settings of other variables such as $EnablePathInfo, $SpaceWikiWords, 
etc.  A skin.php file would also have to be able to do the right 
thing when directives such as [[noheader]], [[nofooter]], [[notitle]], 
[[spacewikiwords]], etc. are set--adding even more to the complexity.

So, it can be done, but I think for many people learning the variables 
and function internals to make everything work would actually be a 
*bigger* learning curve than simply saying "I want this string to 
go on the left", "I want this other text on the bottom", etc.  Add 
to this the fact that different functions have to be called in other 
sequences for edit, page history, uploads, rss, refcount, etc. and 
I think the skin.php file can get to be fairly complex.  So I'm 
not sure an approach like this out to be less of a learning curve, 
although it's possible.

But perhaps something along these lines can be prototyped for the 
Cookbook--PmWiki certainly has sufficient internal hooks and capabilities
to allow something like this to work.  

Or, build a sample skin.php file that shows what you *wish* you 
could do to set up your layout, and I'll find a way to make it work 
and/or tell you what limitations it will impose on the resulting 
output.  :-)

Pm



More information about the pmwiki-users mailing list