Page 2 of 2

Re: Aktives Menüelement

Posted: Fri Nov 22, 2019 9:43 am
by planlos
Das funktioniert für statische Links prima! Vielen Dank @kohbarg!

Fehlt noch die normale Navigation. Ich habe geschaut und versucht es selbst zu lösen. Editiert habe ich:
/bl-plugins/navigation/plugin.php
Zeile 76 ORIGINAL

Code: Select all

		// Pages order by position
		if (ORDER_BY=='position') {
			// Get parents
			$parents = buildParentPages();
			foreach ($parents as $parent) {
				$html .= '<li class="parent">';
				$html .= '<a href="' . $parent->permalink() . '">' . $parent->title() . '</a>';
Mein Versuch:

Code: Select all

		// Pages order by position
		if (ORDER_BY=='position') {
			// Get parents
			$parents = buildParentPages();
			$active = ($parent->key() == $url->slug())? 'active': '';
			foreach ($parents as $parent) {
				$html .= '<li class="parent ' . $active . '">';
				$html .= '<a href="' . $parent->permalink() . '">' . $parent->title() . '</a>';

Leider ohne Erfolg.

Ein schönes Wochenende allerseits!

Re: Aktives Menüelement

Posted: Fri Nov 22, 2019 5:52 pm
by kohbarg
So auf die schnelle:

Code: Select all

// Pages order by position
		if (ORDER_BY=='position') {
			// Get parents
			$parents = buildParentPages();
			//Hier gibts noch kein $parent nur $parents (mit s)
			//$active = ($parent->key() == $url->slug())? 'active': '';
			foreach ($parents as $parent) {
				//Vielleicht sollte die Abfrage hier hin
			$active = ($parent->key() == $url->slug())? 'active': '';
			
				$html .= '<li class="parent ' . $active . '">';
				$html .= '<a href="' . $parent->permalink() . '">' . $parent->title() . '</a>';
				

Re: Aktives Menüelement

Posted: Tue Nov 26, 2019 9:27 am
by planlos
Guten Morgen!
Vielen Dank für den Hinweis @kohbarg, an der Stelle funktioniert die Codezeile prima!
Für child auch noch eingebaut. Nun zeigt Bludit das Verhalten, was ich haben möchte. :)

Viele Grüße
planlos