Das js_mmenu.html5 Template:
PHP-Code:
<script>
(function($) {
var $mmenu = $('#<?php echo $this->cssIDonly; ?>');
$(document).ready(function() {
$mmenu.mmenu({
navbars=true;
<?php
$oComma = $iComma = false; // o(uter)/i(nner) comma after option needed?
if ($this->isMenu) {
echo ($oComma == true ? ', ' : '') . $this->isMenu;
$oComma = true;
}
if ($this->classes) {
echo ($oComma == true ? ', ' : '') . 'classes: "' . $this->classes . '"';
$oComma = true;
}
if ($this->slidingSubmenus) {
echo ($oComma == true ? ', ' : '') . $this->slidingSubmenus;
$oComma = true;
}
// subobject 'counters' options
if ($this->countersAdd) {
if ($this->countersUpdate) {
echo ($oComma == true ? ', ' : '') . 'counters: { ';
echo $this->countersAdd;
echo ', ' . $this->countersUpdate;
echo ' }'; // end of subobject 'counters' options
} else {
echo ($oComma == true ? ', ' : '') . 'counters: true';
}
$oComma = true;
}
// subobject 'offCanvas' options
if ($this->offCanvas) {
if ($this->offCanvasModal || $this->offCanvasMoveBackground || $this->offCanvasPosition || $this->offCanvasZposition) {
echo ($oComma == true ? ', ' : '') . 'offCanvas: { ';
if ($this->offCanvasModal) {
echo ($iComma == true ? ', ' : '') . $this->offCanvasModal;
$iComma = true;
}
if ($this->offCanvasMoveBackground) {
echo ($iComma == true ? ', ' : '') . $this->offCanvasMoveBackground;
$iComma = true;
}
if ($this->offCanvasPosition) {
echo ($iComma == true ? ', ' : '') . $this->offCanvasPosition;
$iComma = true;
}
if ($this->offCanvasZposition) {
echo ($iComma == true ? ', ' : '') . $this->offCanvasZposition;
$iComma = true;
}
echo ' }'; // end of subobject 'offCanvas' options
$iComma = false; // reset inside subobject comma flag
$oComma = true;
}
} else {
echo ($oComma == true ? ', ' : '') . 'offCanvas: false';
$oComma = true;
}
// subobject 'searchfield' options
if ($this->searchfieldAdd) {
echo ($oComma == true ? ', ' : '') . 'searchfield: { ';
echo $this->searchfieldAdd;
if ($this->searchfieldSearch) {
echo ', ' . $this->searchfieldSearch;
}
if ($this->searchfieldPlaceholder) {
echo ', ' . $this->searchfieldPlaceholder;
}
if ($this->searchfieldNoResults) {
echo ', ' . $this->searchfieldNoResults;
}
if ($this->searchfieldShowLinksOnly) {
echo ', ' . $this->searchfieldShowLinksOnly;
}
echo ' }'; // end of subobject 'searchfield' options
$oComma = true;
}
// subobject 'dragOpen' options
if ($this->dragOpenOpen) {
echo ($oComma == true ? ', ' : '') . 'dragOpen: { ';
echo $this->dragOpenOpen;
if ($this->dragOpenThreshold) {
echo ', ' . $this->dragOpenThreshold;
}
if ($this->dragOpenMaxStartPos) {
echo ', ' . $this->dragOpenMaxStartPos;
}
echo ' }'; // end of subobject 'dragOpen' options
$oComma = true;
}
// subobject 'onClick' options
if ($this->onClickClose || $this->onClickBlockUI) {
echo ($oComma == true ? ', ' : '') . 'onClick: { ';
if ($this->onClickClose) {
echo ($iComma == true ? ', ' : '') . $this->onClickClose;
$iComma = true;
}
if ($this->onClickBlockUI) {
echo ($iComma == true ? ', ' : '') . $this->onClickBlockUI;
$iComma = true;
}
echo ' }'; // end of subobject 'onClick' options
$iComma = false; // reset inside subobject comma flag
$oComma = true;
}
?>
}, {
classNames: {
selected: "active"
}
}).removeClass('invisible');
});
})(jQuery);
</script>
Das mod_mmenu.html5-Template
PHP-Code:
<?php
$GLOBALS['TL_CSS'][] = 'navbars/jquery.mmenu.navbars.css';
$GLOBALS['TL_JAVASCRIPT'][] = 'navbars/jquery.mmenu.navbars.min.js';
?>
<?php if ($this->type == 'mmenu_article'): ?>
<div class="<?php echo $this->class; ?> invisible block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<div>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<?php echo implode('', $this->elements); ?>
</div>
</div>
<?php else: ?>
<!-- indexer::stop -->
<nav class="<?php echo $this->class; ?> invisible block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<a class="close" href="#" style="display:block; width:66.016px; height:50px; color:white; position: relative; z-index: 50;">X</a>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
<a href="<?php echo $this->request; ?>#<?php echo $this->skipId; ?>" class="invisible"><?php echo $this->skipNavigation; ?></a>
<?php echo $this->items; ?>
<a id="<?php echo $this->skipId; ?>" class="invisible"> </a>
</nav>
<!-- indexer::continue -->
<?php endif; ?>
Spooky, so richtig? Ich habe im Contao-Ordner einen Ordner mit den nötigen css- und js-Dateien angelegt und beim mod_mmenu.html5-Template die Verweise berichtigt. Mein mmenu funktioniert jetzt gar nicht mehr bzw. bei klick auf das Menü-Icon wird nicht das Menü geöffnet, sondern auf die Startseite weitergeleitet.
Lesezeichen