[dokuwiki] [patch] Find files in the namespace

  • From: Robin Getz <rgetz@xxxxxxxxxxxxxxxxxxxx>
  • To: DokuWiki Mailinglist <dokuwiki@xxxxxxxxxxxxx>
  • Date: Fri, 10 Sep 2010 10:35:32 -0400

Sometimes in templates - you want to adjust the layout based on files in the 
namespace.

For example - have sidebars per namespace, and only show a sidebar if there is 
one. For that, I needed to add something like this into ./inc/template.php


--- inc/template.php.org        2010-09-10 10:29:29.000000000 -0400
+++ ./inc/template.php  2010-09-10 10:30:24.000000000 -0400
@@ -444,6 +444,21 @@
 }

 /**
+ * see if a file exists in the same namespace,
+ *  default file to look for is 'sidebar'
+ *
+ * return true if the file exists, false otherwise
+ *
+ * @author Robin Getz <robin.getz@xxxxxxxxxx>
+ */
+function tpl_fileexists($id, $file){
+  global $conf;
+  $parent = getNS($id).':'.$file;
+  resolve_pageid('',$parent,$exists);
+  return $exists;
+}
+
+/**
  * Print one of the buttons
  *
  * Available Buttons are
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: