[Pmwiki-users] [PATCH] Allow setting of BasicLayoutVars in local/group/page config

Ari Pollak ajp
Mon Jun 21 07:14:57 CDT 2004


[Please CC me on all replies]

Currently, putting something like $PageHeaderFmt='blah'; in 
local/Group.php to override just the PageHeaderFmt section of the site 
template does not work, because scripts/tlayout.php overrides all of the 
section globals regardless of whether they are previously set or not. 
The attached patch makes tlayout.php only set the global BasicLayoutVars 
(like $PageHeaderFmt) if they're not defined yet, thus making the local 
config take precedence over the defined template.
I haven't found any problems with this nor can I forsee any, I'd only 
imagine that this would make local customizations much easier. (If tihs 
patch goes in, I'll update the appropriate wiki pages on the site to 
reflect that this is now possible, which it should have been before)
-------------- next part --------------
--- scripts/tlayout.php.orig	2004-06-21 03:14:46.000000000 -0400
+++ scripts/tlayout.php	2004-06-21 03:16:39.000000000 -0400
@@ -68,7 +68,10 @@
       $GLOBALS[$ps][] = (count($v)>1) ? $v : $v[0];
       continue;
     } 
-    $GLOBALS[$k] = (count($v)>1) ? $v : $v[0];
+	// If a section global has already been defined, use that instead of
+	// template section
+    if(!defined($GLOBALS[$k]))
+		$GLOBALS[$k] = (count($v)>1) ? $v : $v[0];
     if (in_array($k,$BasicLayoutVars)) {
       $GLOBALS[$ps][] = "<!--$k-->";
       if ($k=='PageText') { $ps = 'PageEndFmt'; }


More information about the pmwiki-users mailing list