Ich habe das selbe Problem mit der Bootstrap Navigation wie schon erwähnt. Ich habe es so gelöst, dass ich die templates mod_navigation und nav_default so angepasst habe, dass die html struktur (bzw. eigentlich nur die Namen der Klassen und ein paar kleinigkeiten wie z.B. das caret) an das von Bootstrap vorgesehene angepasst wird. Natürlich ist das keine saubere Lösung, und es Funktioniert auch nur mit einem maximalen Navigationslevel von 2 (da ich nicht mehr benötige, habe ich mich nicht länger damit befasst die Templates für 3 oder mehr Levels zu bearbeiten). Meine Templates sehen wie folgt aus:
mod_navigation.html5
PHP-Code:
<!-- indexer::stop -->
<nav class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?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>
<div class="navbar-inner">
<a class="brand" href="#">--Title--</a>
<?php echo $this->items; ?>
</div>
<a id="<?php echo $this->skipId; ?>" class="invisible">[nbsp]</a>
</nav>
<!-- indexer::continue -->
nav_default.html5
PHP-Code:
<ul class="<?php echo $this->level; if($this->level == level_1) echo ' nav'; else if($this->level == level_2) echo ' dropdown-menu'; ?>">
<?php foreach ($this->items as $item): ?>
<?php if ($item['isActive']): ?>
<li class="<?php echo $item['class']; if(strpos($item['class'], 'submenu') !== false) echo ' dropdown'; ?>">
<?php if(strpos($item['class'], 'submenu') !== false): ?>
<a class="dropdown-toggle <?php echo $item['class']; ?>" data-toggle="dropdown">
<?php echo $item['link']; ?>
<b class="caret"></b>
<?php else: ?>
<a class="<?php echo $item['class']; ?>">
<?php echo $item['link']; ?>
</a>
<?php endif; ?>
</a>
<?php echo $item['subitems']; ?>
</li>
<?php else: ?>
<li<?php if ($item['class']): ?>
class="<?php echo $item['class'];
if(strpos($item['class'], 'submenu') !== false) echo ' dropdown'; ?>"
<?php endif; ?>>
<a href="<?php echo $item['href']; ?>" title="<?php echo $item['pageTitle'] ? $item['pageTitle'] : $item['title']; ?>"<?php if ($item['class']): ?>
class="<?php echo $item['class']; if(strpos($item['class'], 'submenu') !== false) echo ' dropdown-toggle'; ?>"
<?php if(strpos($item['class'], 'submenu') !== false) echo 'data-toggle="dropdown"'; ?>
<?php endif; ?><?php if ($item['accesskey'] != ''): ?>
accesskey="<?php echo $item['accesskey']; ?>"<?php endif; ?><?php if ($item['tabindex']): ?> tabindex="<?php echo $item['tabindex']; ?>"<?php endif; ?><?php if ($item['nofollow']): ?> rel="nofollow"<?php endif; ?><?php echo $item['target']; ?>><?php echo $item['link']; ?>
<?php if(strpos($item['class'], 'submenu') !== false): ?>
<b class="caret"></b>
<?php endif; ?>
</a><?php echo $item['subitems']; ?>
</li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
Vielleicht hilft das ja jemandem weiter. Trotzdem würde mich interessieren ob es mittlerweile eine gute Möglichkeit gibt, Bootstrap bzw. die Bootstrap Navigation in Contao 3 zu integrieren.
Lesezeichen