Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
nav_newscategories template for the Contao news_categories extension which also takes the jumpTo page into account
<ul class="<?php echo $this->level; ?>">
<?php foreach ($this->items as $item): ?>
<?php
// build link to jumpTo page
if( $item['jumpTo'] )
{
$objJump = \PageModel::findByPk( $item['jumpTo'] );
if( $objJump !== null )
$item['href'] = $this->generateFrontendUrl( $objJump->row() );
}
?>
<?php if ($item['isActive']): ?>
<li class="<?php echo $item['class']; ?>"><span class="<?php echo $item['class']; ?>"><?php echo $item['link']; ?></span><?php if ($this->showQuantity): ?> <span class="quantity">(<?php echo $item['quantity']; ?>)</span><?php endif; ?><?php echo $item['subitems']; ?></li>
<?php else: ?>
<li class="<?php echo $item['class']; ?>"><a href="<?php echo $item['href']; ?>" class="<?php echo $item['class']; ?>" title="<?php echo $item['linkTitle']; ?>"><?php echo $item['link']; ?><?php if ($this->showQuantity): ?> <span class="quantity">(<?php echo $item['quantity']; ?>)</span><?php endif; ?></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
You can’t perform that action at this time.