Changeset 937 in t29-www


Ignore:
Timestamp:
Mar 30, 2016, 3:18:10 PM (7 years ago)
Author:
sven
Message:

Probeweise ein "Design-Testystem" eingeführt. Die Seite lässt sich nun unter beliebigen Namen wie http://irgendwas.design.technikum29.de/ aufrufen, was dazu führt, dass dieses "irgendwas" als Bodyklasse im HTML-Code landet und per CSS darauf reagiert werden kann. Nicht besonders flexibel, diese Lösung, aber zumindest unauffällig für normale Besucher.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/host.php

    r809 r937  
    139139                        case 'localhost':
    140140                                $localhost = self::new_singleton('t29HeribertHost');
     141                                $localhost->setup();
     142                                return $localhost;
     143                        case strpos($_SERVER['SERVER_NAME'], 'design') !== false:
     144                                /* Hostnames like foobar.design.technikum29.de */
     145                                $localhost = self::new_singleton('t29DesignHost');
    141146                                $localhost->setup();
    142147                                return $localhost;
     
    320325}
    321326
     327class t29DesignHost extends t29Host {
     328        /**
     329         * A host like "foobar.design.technikum29.de". This allows CSS to detect
     330         * the body class "host-foobar-design".
     331         **/
     332        public $hostname = 'design';
     333        public $designname = 'undefined';
     334
     335        function fillup_template_conf(&$template_conf) {
     336                if(preg_match('/^([^.]+)\.design/i', $_SERVER['SERVER_NAME'], $matches))
     337                        $this->designname = strtolower($matches[1]).'-design';
     338
     339                $template_conf['body_classes_append'][] = $this->designname;
     340        }
     341}
     342
    322343/**
    323344 * Host auf heriberts Rechner; dort wird ein weiterer Metatag mit id eingefuehrt,
  • lib/template.php

    r930 r937  
    7474                        $this->conf['header_prepend'] = array($this->conf['header_prepend']); // string to list
    7575
     76                // optional body css classes which can be filled by hooks or parts
     77                if(!isset($this->conf['body_classes_append']))
     78                        $this->conf['body_classes_append'] = array();
     79
    7680                // ask t29Host for configuration fillup
    7781                $this->conf['host']->fillup_template_conf($this->conf);
     82                $this->body_classes += $this->conf['body_classes_append'];
    7883               
    7984                // Path names in messages
  • shared/css-v6/modules/10-window.css

    r929 r937  
    99        /* Hintergrund oben horizontal, fuer unten siehe footer css files */
    1010        background: #cbc5bd url("/shared/img-v6/bg-v2.body.png") repeat-x;
    11        
     11}
     12
     13body.bg-test1-design {
     14        /* Testweise erreichbar unter http://bg-test1.design.technikum29.de */
    1215        /* Neuer Hintergrund ab 2016, noch nicht aktiv: */
    13         /*background: #d0d8dd url("/shared/img-v6/bg2016-v2.body.png") repeat-x;*/
     16        background: #d0d8dd url("/shared/img-v6/bg2016-v2.body.png") repeat-x;
    1417}
    1518
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