Changeset 254 in t29-www for lib/template.php
- Timestamp:
- May 25, 2012, 7:58:22 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/template.php
r252 r254 7 7 * $seiten_id = kurzkennung der aktuellen seite 8 8 * $root = Seiten-Root fuer URLs ($root/de, $root/shared, etc.) 9 * $titel = Seitentitel 10 * $header_cache_file, $footer_cache_file. 9 11 **/ 12 13 class t29Template { 14 public $conf; 15 public $menu; 10 16 11 function print_header() { 12 global $lang, $seiten_id, $root, $lib; 17 function __construct($conf_array) { 18 $this->conf = $conf_array; 19 20 // create a menu: 21 require_once $this->conf['lib'].'/menu.php'; 22 $this->menu = new t29Menu($this->conf); 23 } 24 25 /** 26 * Main caching and output system. 27 * Parameters (global configuration): 28 * skip_cache - if true, skips writing output to cache file 29 * purge_cache - if true, forces creation of new cache file 30 * (does not change behaviour of this file's code) 31 **/ 32 function create_cache() { 33 ob_start(); 34 $this->print_header(); 35 register_shutdown_function(array($this, 'create_cache_shutdown')); 36 } 37 38 function create_cache_shutdown() { 39 $this->print_footer(); 40 $whole_page = ob_get_flush(); 41 if($this->conf['skip_cache']) { 42 echo "<!-- debug mode, skipped cache and cache saving. -->"; 43 return; // do not save anything 44 } 45 46 if(!file_exists($this->conf['cache_file'])) { 47 t29Template::mkdir_recursive(dirname($this->conf['cache_file'])); 48 } 13 49 50 file_put_contents($this->conf['cache_file'], $whole_page); 51 } 52 53 public static function mkdir_recursive($pathname) { 54 is_dir(dirname($pathname)) || t29Template::mkdir_recursive(dirname($pathname)); 55 return is_dir($pathname) || @mkdir($pathname); 56 } 57 58 function print_header() { 14 59 ?> 15 60 <!doctype html> … … 17 62 <head> 18 63 <meta charset="utf-8"> 19 20 <title>Mockup t29v6</title> 64 <title><?php isset($this->conf['titel']) ? $this->conf['titel'].' - ' : ''; ?> technikum29</title> 21 65 <meta name="description" content="Produziert am 08.01.2012"> 22 66 <meta name="author" content="Sven"> 67 <meta name="generator" content="t29v6 $Id$"> 68 <meta name="t29.cachedate" content="<?php print date('r'); ?>"> 23 69 <meta name="viewport" content="width=device-width,initial-scale=1"> 24 70 <link rel="stylesheet" href="/shared/css-v6/boiler.css"> … … 35 81 <div id="background-color-container"><!-- helper --> 36 82 <section class="main content" role="main" id="content"> 37 <!--### START EXAMPLE CONTENT ###-->38 83 <!--<header class="teaser"> 39 84 <h2 id="pdp8L">Wissenschaftliche Rechner und Minicomputer</h2> 40 85 <img width=880 src="http://www.technikum29.de/shared/photos/rechnertechnik/univac/panorama-rechts.jpg"> 41 86 </header>--> 87 <!-- start content --> 42 88 <?php 43 89 } // function print_header(). … … 45 91 function print_footer() { 46 92 ?> 47 <!-- ### END EXAMPLE CONTENT ###-->93 <!-- end content --> 48 94 </section> 49 95 <hr> … … 51 97 <h2 class="visuallyhidden">Museumstour</h2> 52 98 <nav class="side"> 53 <?php print_menu("sidebar")?>99 <?php $this->menu->print_menu($this->menu->sidebar_menu); ?> 54 100 <span class="button collapse-menu">Menü ausklappen</span> 55 101 </nav> … … 63 109 <h2 class="visuallyhidden">Hauptnavigation</h2> 64 110 <nav class="horizontal"> 65 <?php print_menu("hauptnavigation"); ?>111 <?php $this->menu->print_menu($this->menu->horizontal_menu); ?> 66 112 </nav> 67 113 <nav class="top"> … … 85 131 <nav class="rel clearfix"> 86 132 <ul> 87 <?php print_relations(); ?>133 <?php $this->menu->print_relations(); ?> 88 134 <!-- 89 135 <li class="prev"><a href="#">vorherige Seite <strong>Univac 9200</strong></a> … … 98 144 <div class="icons"> 99 145 <a href="/de-v6/impressum.php#image-copyright"><img src="/shared/img-v6/cc-icon.png"></a> 100 < a href="http://ufopixel.de" title="Designed by Ufopixel"><img src="http://svenk.homeip.net/dropbox/Ufopixel/Ufopixel-Design/logo_90x30/ufopixel_logo_90x30_version2.png"></a>146 <!--<a href="http://ufopixel.de" title="Designed by Ufopixel"><img src="http://svenk.homeip.net/dropbox/Ufopixel/Ufopixel-Design/logo_90x30/ufopixel_logo_90x30_version2.png"></a>--> 101 147 </div> 102 148 <!--CC<br>Viele Bilder können unter einer CreativeCommons-Lizenz … … 125 171 </html> 126 172 <?php 127 } // function print_footer() 128 ?> 173 } // function print_footer() 174 175 } // class t29Template
Note: See TracChangeset
for help on using the changeset viewer.