[Pmwiki-users] SHTML-like templates for PmWiki

Patrick R. Michaud pmichaud at sci.tamucc.edu
Mon Dec 16 16:33:02 CST 2002


On Sun, 15 Dec 2002, niall b durham wrote:

> [...]  In addition, I didn't want to modify any PmWiki code to do
> this (if possible)--and potentially cut myself off from future
> upgrades.  As it turned out, due to the (good) design of PmWiki, I 
> didn't have to modify it. 

Thanks.  This is actually goes to some of my design goals for PmWiki--
it should be flexible and also be a component within larger systems
and designs.  So I've tried to make sure that PmWiki has an upgrade
path that won't break existing systems that include PmWiki as a component.

> > As long as we're doing it this way, why not just use the PHP syntax
> > for Niall's proposal from the outset?  Let the administrator create
> > an HTML file containing embedded PHP instead of SHTML.  This results
> > in the following replacements for Niall's directives:
> > 
> >     <!--#include file="foo.inc"-->
> > 	becomes
> >     <?php include("foo.inc"); ?>

> I like this approach.  The only snag I'm wondering about is the current
> directory when the include() is processed.  In the template.php
> script, it uses the path of the template file as the filename prefix for 
> the include statement.  [...]
> In comparison, say Main.tmpl was included via the PHP mechanism.  
> Assuming that the CWD is pmwiki/, then as I understand things, I would 
> have to use the following directive:
> 
>     <?php include("template/foo.inc"); ?>
> 
> I find this slightly confusing/annoying.  However, we could modify 
> the include_path, or set the CWD before processing a template, so I
> suppose I'm just niggling.  

You're correct about what would need to happen.  However, be careful
about modifying the CWD:  PmWiki in its default configuration pretty 
much assumes that the current directory is the directory containing 
wiki.d.  PmWiki can be configured so that this isn't the case, but
it's important to be aware of the default assumption.

Overall I think that using the relative path in the include(...) 
statement will be okay.

Pm





More information about the pmwiki-users mailing list