[geeklog-cvs] geeklog-1.3/system lib-plugins.php,1.31,1.32

blaine at iowaoutdoors.org blaine at iowaoutdoors.org
Wed Aug 25 23:31:35 EDT 2004


Update of /var/cvs/geeklog-1.3/system
In directory www:/tmp/cvs-serv22637/system

Modified Files:
	lib-plugins.php 
Log Message:
Added new Plugin API to be able to set template vars. We can now add these calls where it makes sense - I've  added it to COM_siteHeader for now. Plugins can then set {variables} that can be used in the header.thtml or other templates if the PLG API call is added.

Index: lib-plugins.php
===================================================================
RCS file: /var/cvs/geeklog-1.3/system/lib-plugins.php,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** lib-plugins.php	9 Aug 2004 07:56:22 -0000	1.31
--- lib-plugins.php	26 Aug 2004 03:31:30 -0000	1.32
***************
*** 758,761 ****
--- 758,783 ----
  
  /**
+ * This function can be called to check if an plugin wants to set a template variable
+ * Example in COM_siteHeader, the API call is now added
+ * A plugin can now check for templatename == 'header' and then set additional template variables
+ *
+ * @param   string   $templatename     Name of calling template - used as test in plugin function
+ * @param   ref      $template         reference for the Template
+ *
+ */
+ function PLG_templateSetVars ($templatename, &$template)
+ {
+     global $_TABLES;
+ 
+     $query = DB_query("SELECT pi_name FROM {$_TABLES['plugins']} WHERE pi_enabled = 1");
+     while (list ($pi_name) = DB_fetchArray($query)) {
+         $function = 'plugin_templatesetvars_' . $pi_name;
+         if (function_exists($function)) {
+             $function ($templatename, $template);
+         }
+     }
+ }
+ 
+ /**
  * This function is called from COM_siteHeader and will return additional Header information
  * This can be Javascript functions required for the plugin or extra Metatags




More information about the geeklog-cvs mailing list