public static function create($pagename = null) { /* * e.g., 'MyCoolTheme__Page' */ $theme_class = THEME_NAME . '__Page'; /* * e.g., '/themes/class.Page.inc.php' */ $theme_file = THEME_DIR . 'class.Page.inc.php'; if (check_file_available($theme_file)) { require_once $theme_file; return new $theme_class($pagename); } }
/** * Get our template data */ public function load_template($template_file) { /* * Save the contents of the template file to a variable. First check APC and see if it's * stored there. */ $storage_name = 'template-' . $this->theme_name . '-' . $this->page; if (APC_RUNNING === TRUE) { $html = apc_fetch($storage_name); if ($html === FALSE) { if (check_file_available($template_file)) { $html = file_get_contents($template_file); } apc_store($storage_name, $html); } } else { $html = file_get_contents($template_file); } return $html; }
/** * Get our template data */ public function load_template($template_file) { /* * Save the contents of the template file to a variable. See if it's already cached in * memory. */ $storage_name = 'template-' . $this->theme_name . '-' . $this->page; global $cache; if (isset($cache)) { $html = $cache->retrieve($storage_name); if ($html === FALSE) { if (check_file_available($template_file)) { $html = file_get_contents($template_file); } $cache->store($storage_name, $html); } } else { $html = file_get_contents($template_file); } return $html; }