[Pmwiki-users] Re: Re: Request for a callback once stdconfig.php has been included

Christian Ridderström chr
Sat Feb 14 10:55:15 CST 2004

On Sat, 14 Feb 2004, Patrick R. Michaud wrote:

> On Sat, Feb 14, 2004 at 05:20:09AM +0100, Christian Ridderstr?m wrote:
> > A serious question though. If I manually include stdconfig.php from
> > config.php, then this code will not have been executed before that:
> > 	SDV($DefaultPage,"$DefaultGroup/$DefaultTitle");
> > 	if ($pagename=='') $pagename=$DefaultPage;
> > I thought about this before, and it's bit like a chicken-and-hen problem
> >
> > One possible solution would be to use a function SetDefaultPage():
> > [...]
> Even easier will be to have stdconfig.php set the default page instead
> of pmwiki.php, which I'm now doing.  Thus include_once("scripts/stdconfig.php");
> will automatically set the pagename and the config.php author wouldn't 
> have to worry about it.  Wish I had thought of this sooner.  :-)

I'm a bit slow (was out late yesterday), so I'm afraid I don't follow. 
Isn't it config.php that typically sets:


Or are you talking about the default values for the above variables? 
And for that matter.... what's the purpose of these variables?

> Cookbook scripts that require having a pagename set should also
> do
>         if ($pagename=='') $pagename=$DefaultPage;
> The only time this matters is when PmWiki is called without a pagename,
> e.g, as ".../pmwiki/pmwiki.php" and not ".../pmwiki/pmwiki.php/Group/SomePage".

I think this happens quite often actually, because when you direct someone
to a wiki site, you're lazy and only type e.g. www.pmichaud.com/wiki
rather than the full thing. What I mean is that this isn't really a case
we should ignore.


> > 	function SetDefaultPage($group, $title) {
> > 	  global $DefaultPage, $DefaultGroup, $DefaultTitle, $pagename;
> > 	  $DefaultGroup=$group;
> > 	  $DefaultTitle=$title;
> > 	  $DefaultPage="$DefaultGroup/$DefaultTitle";
> > 	  if (''==$pagename) $pagename=$DefaultPage;
> >         }
Christian Ridderstr?m                           http://www.md.kth.se/~chr

More information about the pmwiki-users mailing list