Changeset 276 in t29-www for lib/template.php


Ignore:
Timestamp:
Jul 7, 2012, 7:45:22 PM (12 years ago)
Author:
sven
Message:

Weitere Fixes in den Geräteseiten:

  • Univac-Geräteseiten konvertiert
  • Interlang-System verbessert (bessere Ausgabe bei nicht existierenden Interlang-Links)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/template.php

    r275 r276  
    121121        // print interlanguage links for all languages except the active one
    122122        foreach($this->interlang_links as $lang => $a) {
    123                 if($lang != $this->conf['lang']) {
     123                if($lang != $this->conf['lang'] && !is_null($a)) {
    124124                        printf('<link rel="alternate" href="%s" hreflang="%s" title="%s">',
    125                                 $a['href'], $lang, sprintf($_('head-rel-interlang'), $a)
     125                                $a['href'], $lang, sprintf($_('head-rel-interlang', $lang), $a)
    126126                        );
    127127                }
     
    192192                                <?php
    193193                                        foreach($this->interlang_links as $lang => $a) {
     194                                                $is_current_lang = $lang == $this->conf['lang'];
     195                                                if(is_null($a)) {
     196                                                        // when interlanguage link not present (null) = no translation exists
     197                                                        $a = t29Menu::dom_new_link('#', 'not present');
     198                                                        $title = sprintf($_('topnav-interlang-nonexistent', $lang));
     199                                                        $class = 'nonexistent';
     200                                                } elseif($is_current_lang) {
     201                                                        $title = sprintf($_('topnav-interlang-active'), $a);
     202                                                        $class = 'active';
     203                                                } else {
     204                                                        // ordinary interlang link
     205                                                        $title = sprintf($_('topnav-interlang-title', $lang), $a);
     206                                                        $class = '';
     207                                                }
    194208                                                printf("\t\t\t\t<li%s><a href='%s' title='%s'>%s</a></li>\n",
    195                                                         ($lang == $this->conf['lang'] ? ' class="active"' : ''),
    196                                                         $a['href'], sprintf($_('topnav-interlang-title'), $a),
     209                                                        (empty($class) ? '' : " class='$class'"),
     210                                                        $a['href'], htmlspecialchars($title),
    197211                                                        $this->conf['languages'][$lang][0] // verbose language name
    198212                                                );
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