Changeset 265 in t29-www for lib


Ignore:
Timestamp:
May 31, 2012, 2:39:20 AM (12 years ago)
Author:
sven
Message:

Bugfixes:

  • menu.js, template.php, style.css: Loesung fuer abhauenden Menubutton (get-menu) am Ende der Seite (schob sich unter Footer) gefunden, Menue kann jetzt zu jeder Zeit eingeblendet werden.
  • cache.php: Dokumentation
  • navigation.xml: Typos beseitigt
Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/cache.php

    r264 r265  
    3131        public $verbose = false; // print html comments and errors
    3232
    33         public $cache_file;
    34         public $test_files = array();
     33        // these must be set after constructing!
     34        public $cache_file; // must be set!
     35        public $test_files = array(); // must be set!
    3536
    3637        private $mtime_cache_file = null; // needed for cache header output
     
    6162        }
    6263
     64        /**
     65         * Calculates and compares the mtimes of the cache file and testing files.
     66         * Doesn't obey any debug/skip/purge rules, just gives out if the cache file
     67         * is valid or not.
     68         * The result is cached in $is_valid, so you can call this (heavy to calc)
     69         * method frequently.
     70         **/
    6371        function is_valid() {
    6472                // no double calculation
     
    8997        }
    9098
     99        /**
     100         * The "front end" to is_valid: Takes skipping and purging rules into
     101         * account to decide whether you shall use the cache or not.
     102         * @returns boolean value if cache is supposed to be valid or not.
     103         **/
    91104        function shall_use() {
    92105                $test = $this->is_valid() && !$this->skip && !$this->purge;
     
    97110        }
    98111       
     112        /**
     113         * Prints out cache file with according HTTP headers and HTTP caching
     114         * (HTTP_IF_MODIFIED_SINCE). You must not print out anything after such a http
     115         * header! Therefore consider using the convenience method print_cache_and_exit()
     116         * instead of this one or exit on yourself.
     117         **/
    99118        function print_cache() {
    100119                // make sure we already have called is_valid
     
    124143        }
    125144       
     145        /**
     146         * Convenience method which will exit the program after calling print_cache().
     147         **/
    126148        function print_cache_and_exit() {
    127149                $this->print_cache();
     
    129151        }
    130152
     153        /**
     154         * Convenience method for calling the typical workflow: Test if the cache file
     155         * shall be used, and if yes, print it out and exit the program. If this method
     156         * returns, you can be sure that you have to create a (new) cache file. So your
     157         * typical code will look like:
     158         *
     159         *  $cache = new t29Cache();
     160         *  // initialization stuff $cache->... = ...
     161         *  $cache->try_cache_and_exit();
     162         *  // so we are still alive - go making content!
     163         *  $cache->start_cache(...);
     164         *  echo "be happy";
     165         *  $cache->write_cache(); // at least if you didn't use any registered shutdown function.
     166         *
     167         **/
    131168        function try_cache_and_exit() {
    132169                if($this->shall_use())
     
    216253        }
    217254       
    218         function print_info($string, $even_if_nonverbose=false) {
     255       
     256        private function print_info($string, $even_if_nonverbose=false) {
    219257                if($this->verbose || $even_if_nonverbose)
    220258                        echo "<!-- t29Cache: $string -->\n";
    221259        }
    222260       
    223         function print_error($string, $even_if_nonverbose=false) {
     261        private function print_error($string, $even_if_nonverbose=false) {
    224262                if($this->verbose || $even_if_nonverbose)
    225263                        echo "<div class='error t29cache'>t29Cache: $string</div>\n";
  • lib/template.php

    r264 r265  
    134134        </section>
    135135        <hr>
    136         <section class="sidebar">
     136        <section class="sidebar top">
    137137                        <h2 class="visuallyhidden"><?php $p("sidebar-h2-tour"); ?></h2>
    138138                        <nav class="side">
     
    140140                        </nav>
    141141                        <!-- menu changing buttons are made with javascript -->
     142        </section>
     143        <section class="sidebar bottom">
     144                <!-- inhalte die unten ueber dem header sind -->
    142145        </section>
    143146        </div><!-- div id="background-color-container" helper end -->
Note: See TracChangeset for help on using the changeset viewer.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License