[dokuwiki] Re: New Configuration settings and templates

  • From: Ben Coburn <btcoburn@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Wed, 10 May 2006 02:12:54 -0700


On May 10, 2006, at 1:47 AM, Chris Smith wrote:

Martin Tschofen wrote:
Any chance I can look at your example? I looked at Esther's minima in
splitbrains templates but it can't find a dev version that uses the
latest build.

<snip>

I refer to it in my template as $conf['tpl']['ia']['admin_enable']

When I use 'print_r' to look at $conf, none of the variables show up.

Interestingly enough though, a plugin that I've setup in such a way
shows up in $conf and saves to the local.php.
As I said befre, there are no DokuWiki routines for reading in the templates config variables. My example doesn't read them in either. Because they are stored in a php file as $conf[setting], they will need a special routine to read them in and ensure they get added to config settings as $conf['tpl'][<current template name>][setting].

I am not sure if anything has been written for these elsewhere. If there hasn't been, I'll look at preparing some routines that can be used to do this. For now you are looking at reading your config file inside a function something like this...

function load_tpl_config() {
 global $conf;
 $tpl = $conf['template'];
 $tpl_config = read_tpl_config_file();

 foreach ($tpl_config as $key => $value) {
   if (isset($conf['tpl'][$tpl][$key])) continue;
   $conf['tpl'][$tpl][$key] = $value;
 }
}

function read_tpl_config_file() {
 $conf = array();
 @include(DOKU_TPL.'conf/default.php');

 return $conf;
}

Cheers,

Chris

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist




Isn't this a candidate for being called from "inc/template.php#template" just before returning the correct template to include in "inc/actions.php#act_dispatch"?


Regards, Ben Coburn


------------------- silicodon.net -------------------

--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: