Hallo Ihr Lieben...
Hoffentlich bin ich hier richtig!?!
Ich habe hier ein modifiziertes Navigationsmodul (siehe Code) welches bei älteren Typoligt-Versionen funktionierte und bei meiner aktuellen Version (Contao 2.11.5) nicht mehr richtig funktioniert.
Das Modul hält den zu letzt besuchten Navigationspunkt aktiv, auch wenn man eine versteckte, bzw. eine Seite außerhalb der Referenzseite (Seitenstruktur) anklickt.
Mein Problem: Das Modul blendet aber leider das letzte Level in der Navigation aus und zeigt diesen nicht an.
Könnt ihr erkennen woran das liegt?
Ich müsste eine Lösung bis Montag Mittag finden!
Vielen lieben Dank im Voraus.
meilenstein
Code:
class ModuleMemoryNavigation extends Module
{
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_navigation';
/**
* Do not display the module if there are no menu items
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE')
{
$objTemplate = new BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### NAVIGATION MENU ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
$strBuffer = parent::generate();
return strlen($this->Template->items) ? $strBuffer : '';
}
/**
* Generate module
*/
protected function compile()
{
global $objPage;
$trail = $objPage->trail;
$level = ($this->levelOffset > 0) ? $this->levelOffset : 0;
// Overwrite with custom reference page
if ($this->defineRoot && $this->rootPage > 0)
{
$trail = array($this->rootPage);
$level = 0;
}
// Get all active subpages
$objSubpages = $this->Database->prepare("SELECT * FROM tl_page WHERE pid=? AND type!=? AND type!=? AND type!=?" . ((!$this instanceof ModuleSitemap && FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN) ? " AND guests!=1" : "") . (!BE_USER_LOGGED_IN ? " AND (start='' OR start<?) AND (stop='' OR stop>?) AND published=1" : "") . " ORDER BY sorting")
->execute($trail[$level], 'root', 'error_403', 'error_404', $time, $time);
$blnMemory = false;
while( $objSubpages->next() )
{
if ($objPage->id == $objSubpages->id || ($objPage->mainAlias == $objSubpages->alias && !$objSubpages->hide))
{
$_SESSION['MEMORYNAV'] = $objSubpages->id;
$blnMemory = true;
break;
}
}
$intPage = $objPage->id;
if (!$blnMemory)
{
$objPage->id = $_SESSION['MEMORYNAV'];
}
$this->Template->request = $this->getIndexFreeRequest(true);
$this->Template->skipId = 'skipNavigation' . $this->id;
$this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']);
$this->Template->items = $this->renderNavigation($trail[$level]);
$objPage->id = $intPage;
}
}
?>
Lesezeichen