Keyword

Link to category from content module?

  • Kelsey Brookes
  • Kelsey Brookes's Avatar Topic Author
  • Offline
  • Elite Member
More
12 years 7 months ago #62802 by Kelsey Brookes
Link to category from content module? was created by Kelsey Brookes
I'm using template overrides to get mod_k2_content to display in a fairly specific manner.

I can see this code in the unmodified version of default.php:
<?php if($params->get('itemCategory')): ?>
      <?php echo JText::_('K2_IN') ; ?> <a class="moduleItemCategory" href="<?php echo $item->categoryLink; ?>"><?php echo $item->categoryname; ?></a>
      <?php endif; ?>

But the problem is that it's within an 'foreach $items' declaration, which means that it will only appear alongside a link to the content item that's being linked to.

However, this category module is showing just the one selected category and I'd like to be able to display it's name just once with a link to that category, something like this:
<h2><a class="moduleItemCategory" href="<?php echo $this->category->link; ?>"><?php echo $item->categoryname; ?></a></h2>

But that breaks the site entirely.

Any suggestions as to how I might achieve a header for mod_k2_content that links the header to the category the module is targeting?

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum