Index: lib/cache.php =================================================================== --- lib/cache.php (revision 546) +++ lib/cache.php (revision 560) @@ -39,7 +39,7 @@ private $is_valid = null; // cache output value - function __construct($debug=false, $verbose=false) { + function __construct($debug=false, $verbose=false, $skip=false) { // default values - $this->skip = isset($_GET['skip_cache']); + $this->skip = isset($_GET['skip_cache']) || $skip; $this->purge = isset($_GET['purge_cache']); $this->debug = isset($_GET['debug_cache']) || $debug; @@ -274,16 +274,16 @@ if($this->skip) { $this->print_info('skipped cache and cache saving.'); - return; // do not save anything. - } - - if(!file_exists($this->cache_file)) { - if(!self::mkdir_recursive(dirname($this->cache_file))) - $this->print_error('Could not create recursive caching directories'); - } - - if(@file_put_contents($this->cache_file, $content)) - $this->print_info('Wrote output cache successfully'); - else - $this->print_error('Could not write page output cache to '.$this->cache_file); + //return; // do not save anything. + } else { + if(!file_exists($this->cache_file)) { + if(!self::mkdir_recursive(dirname($this->cache_file))) + $this->print_error('Could not create recursive caching directories'); + } + + if(@file_put_contents($this->cache_file, $content)) + $this->print_info('Wrote output cache successfully'); + else + $this->print_error('Could not write page output cache to '.$this->cache_file); + } if($clear_ob_cache) Index: lib/technikum29.php =================================================================== --- lib/technikum29.php (revision 546) +++ lib/technikum29.php (revision 560) @@ -9,4 +9,7 @@ if(defined('T29')) return false; // no nesting define('T29', true); + +// is it an external call? +$external = isset($external); // at least the $seiten_id must be defined @@ -35,5 +38,5 @@ } -// check for url rewriting neccessarity +// check for url rewriting neccessarity (skip at external calls) if($host->check_url_rewrite()) exit; @@ -51,5 +54,5 @@ // try to determine the language from the file path -$lang = substr($file, 1, 2); +if(!isset($lang)) $lang = substr($file, 1, 2); if(!in_array($lang, array_keys($languages))) $lang = "de"; # check if language exists $lang_path = $languages[$lang][1]; # shorthand, relative to webroot. use "$webroot$lang_path" for local. @@ -57,14 +60,27 @@ // "AJAX" calls are our meaning for pages without chrome $ajax = isset($_GET['ajax']); -if($ajax) { +if(!$external && $ajax) { // print only a minimal chrome, no caching. require "$lib/ajax-template.php"; $ajax_tmpl = new t29AJAXTemplate($GLOBALS); $ajax_tmpl->print_page(); - // important: do not execute bottom code + // important: do not execute code further down (Templating stuff) return true; } require "$lib/cache.php"; + +// "External" pages which are not part of the t29 website +if($external) { + // skip caching stuff. External pages don't get in touch with + // any navigation.xml or news.php etc. + require "$lib/template.php"; + $header_cache = new t29Cache(/*debug*/false, /*verbose*/true, /*skip=memory only*/true); + $footer_cache = new t29Cache(/*debug*/false, /*verbose*/true, /*skip=memory only*/true); + $tmpl = new t29Template($GLOBALS); + $tmpl->create_separate_caches($header_cache, $footer_cache); + // important: do not execute caching stuff below + return true; +} $page_cache = new t29Cache(false, true); // debug, verbose Index: lib/template.php =================================================================== --- lib/template.php (revision 546) +++ lib/template.php (revision 560) @@ -52,7 +52,7 @@ $this->log = t29Log::get(); - // create a menu: + // create a menu, if not given: require_once $this->conf['lib'].'/menu.php'; - $this->menu = new t29Menu($this->conf); + $this->menu = isset($this->conf['menu']) ? $this->conf['menu'] : new t29Menu($this->conf); // create localisation class: @@ -71,4 +71,6 @@ if(!isset($this->conf['header_prepend'])) $this->conf['header_prepend'] = array(); // list + elseif(is_string($this->conf['header_prepend'])) + $this->conf['header_prepend'] = array($this->conf['header_prepend']); // string to list // ask t29Host for configuration fillup @@ -229,5 +231,7 @@ foreach($this->conf['header_prepend'] as $h) print $h."\n "; - if($this->conf['ajax']) print "\n "; + $indicators = array('ajax', 'external'); + foreach($indicators as $key) + if($this->conf[$key]) print "\n "; if(isset($this->conf['version'])) printf('', $this->conf['version']); @@ -311,8 +315,17 @@
-