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

Christian Ridderström chr
Fri Feb 13 06:55:23 CST 2004


On Fri, 13 Feb 2004, Christian Ridderstr?m wrote:

An alternative solution to this code:

> 	// Execute callback function if it exists
> 	if (function_exists('ConfigCallback'))
> 	  ConfigCallback();

is to add something like this to stdconfig.php

	if (!isset($EnableStdConfigCallback) && !$EnableStdConfigCallback) {
	  if (file_exists('local/stdconfig-callback.php')
	    include_once('local/stdconfig-callback.php');
	}

which would let you use a separate script for things to be done 
after stdconfig.php is finished. Personally, I prefer a callback 
function though, because you can define it in local.php together with the 
other customizations.

An additional thought: Maybe we should rather have a an array called
$ConfigCallbacks which that the names of all callback functions that are
to be executed now? Then it would be easy for extension modules to 
add their own callbacks.

A final thought: In Emacs, the callbacks are referred to as 'hooks', so 
maybe $ConfigHooks is a better name.

/Christian

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr





More information about the pmwiki-users mailing list