Skip to content

Instantly share code, notes, and snippets.

@tim-bec
Last active December 27, 2015 01:59
Show Gist options
  • Save tim-bec/7249043 to your computer and use it in GitHub Desktop.
Save tim-bec/7249043 to your computer and use it in GitHub Desktop.
Contao: Include Modul Filter in regular navigation
<?php
// Include CEs or Modules into the navigation list.
$arrPageFilters = array(
// Page-ID => FilterModule-ID / or FilterContent-ID
23 => 33
);
?>
<ul class="<?php echo $this->level; ?>">
<?php foreach ($this->items as $item): ?>
<?php if ($item['isActive']): ?>
<li class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><span class="active<?php if ($item['class']): ?> <?php echo $item['class']; ?><?php endif; ?>"><?php echo $item['link']; ?></span>
<?php
// Einziger Mod im Original-Template
if(array_key_exists($item['id'], $arrPageFilters))
{
echo $this->getFrontendModule($arrPageFilters[$item['id']]);
#echo $this->getContentElement($arrPageFilters[$item['id']]);
}
?>
<?php echo $item['subitems']; ?></li>
<?php else: ?>
<li<?php if ($item['class']): ?> class="<?php echo $item['class']; ?>"<?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']; ?>"<?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']; ?></a><?php echo $item['subitems']; ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment