functions.php
changeset 4 cde92f6ec29f
parent 2 860ba7141641
child 5 9b96265b5918
--- a/functions.php	Sun Mar 23 20:58:51 2008 -0400
+++ b/functions.php	Sun Mar 23 22:03:57 2008 -0400
@@ -132,3 +132,24 @@
   return "$minutes:$seconds";
 }
 
+/**
+ * Loads the specified theme into Smarty
+ * @param string Theme ID
+ * @return object Smarty object
+ */
+
+function load_theme($theme_id)
+{
+  global $httpd;
+  static $smarty = array();
+  if ( !isset($smarty[$theme_id]) )
+  {
+    $smarty[$theme_id] = new Smarty();
+    $smarty[$theme_id]->template_dir = "./themes/$theme_id";
+    $smarty[$theme_id]->compile_dir = "./themes/$theme_id/compiled";
+    $smarty[$theme_id]->cache_dir = "./cache";
+    $smarty[$theme_id]->config_dir = "./config";
+    $httpd->add_handler("themes/$theme_id", 'dir', "./themes/$theme_id");
+  }
+  return $smarty[$theme_id];
+}