[pmwiki-devel] Form messages question

marc gmane at auxbuss.com
Thu Jan 4 03:35:52 CST 2007


Patrick R. Michaud said...
> On Wed, Jan 03, 2007 at 05:25:08PM -0000, marc wrote:
> > Patrick R. Michaud said...
> > > On Wed, Jan 03, 2007 at 11:24:04AM -0000, marc wrote:
> > > > I thought that all I needed to do in HandleSomeAction() is:
> > > > 
> > > >   global $MessagesFmt;
> > > >   $MessagesFmt[] = 'some message';
> > > >   Redirect($pagename);
> > > > 
> > > > But this doesn't work.
> > > ...
> > > What you probably really want is to simply call 
> > > HandleBrowse() (or whatever is in $HandleActions['browse']),
> > > so that PmWiki will re-display the form along with your
> > > validation message(s).
> > 
> > Should I simply exit the handler function with return after HandleBrowse
> > ()? (On the presumption that I'm done with the function, obviously ;-) )
> 
> I would do it as:
> 
>     # ...
>     global $HandleActions, $MessagesFmt;
>     $MessagesFmt[] = 'some message';
>     $fn = $HandleActions['browse'];
>     return $fn($pagename, $auth);

I see. Although I'm unlikely to override $HandleActions['browse'], I 
guess a recipe might. I think I'll dig in and unravel HandleBrowse().

I have to say that I find using $HandleActions extremely useful for 
reducing the number of included PHP files. I've found that I can 
separate quite a lot of functionality by group, and so by using group 
customization files (i.e. <groupname>.php) and HandleActions, I can 
avoid loading a bunch of stuff in farmconfig.php (usually as recipes).

Also, by using the HandleActions as a 'front end' to class files, this 
reduces the load too (because only the HandleActions called will load 
their classes).

However, it's not just the performance that improves - it's not huge, 
just the difference between a snappy page and one that lags slightly - 
but it makes it easy to find what is going on where, and where to go to 
change things. Excellent.

Thanks again for the assist.

-- 
Cheers,
Marc




More information about the pmwiki-devel mailing list