diff --git a/README.md b/README.md index 2cdee5b..97a4141 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ echo '
'; $nav = new rex_lang_nav(); $nav->setulId("lang-nav"); // ul id: "lang-nav" +$nav->setUlClass("my-lang-class"; // ul class: "my-lang-class" $nav->setselectedClass("current"); // li klasse für selektierten menüpunkt: "current" $nav->setshowLiIds(true); // zusätzliche, eindeutige li id's werden ausgegeben $nav->sethideLiIfOfflineArticle(false); // bei einem offline artikel li nicht verstecken sondern auf startartikel der website verlinken diff --git a/classes/class.rex_lang_nav.inc.php b/classes/class.rex_lang_nav.inc.php index a1caa26..f86e35d 100644 --- a/classes/class.rex_lang_nav.inc.php +++ b/classes/class.rex_lang_nav.inc.php @@ -2,6 +2,7 @@ class rex_lang_nav { protected $ulId; + protected $ulClass; protected $selectedClass; protected $showLiIds; protected $hideLiIfOfflineArticle; @@ -10,6 +11,7 @@ class rex_lang_nav { public function __construct() { $this->ulId = ''; + $this->ulClass = ''; $this->selectedClass = 'selected'; $this->showLiIds = false; $this->hideLiIfOfflineArticle = false; @@ -20,6 +22,10 @@ public function __construct() { public function setUlId($ulId) { $this->ulId = $ulId; } + + public function setUlClass($ulClass) { + $this->ulClass = $ulClass; + } public function setSelectedClass($selectedClass) { $this->selectedClass = $selectedClass; @@ -50,6 +56,11 @@ public function getNavigation() { } else { $ulIdAttribute = ' id="' . $this->ulId . '"'; } + + // ul class + if ($this->ulClass != '') { + $ulIdAttribute .= ' class="' . $this->ulClass . '"'; + } $out = '';