Keyword

K2 related items in item.php add specific category

  • Marcel Fossen
  • Marcel Fossen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130747 by Marcel Fossen
We have this nice template for a K2item and we want to show related items by tag. It's a basic funtion but unlike the k2 tools module, we are not able to choose the category of the related items we want to show. Is there a possibility to ad the category ID in the item.php?

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

  • Marcel Fossen
  • Marcel Fossen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 2 months ago #130748 by Marcel Fossen
Replied by Marcel Fossen on topic Re: K2 related items in item.php add specific category
<?php
foreach($this->relatedItems as $key=>$item):
if($this->item->catid != $item->catid):
continue;
endif;
?>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 2 months ago #130749 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: K2 related items in item.php add specific category
This will work.

A trailing endforeach; is missing and I do not think you need continue;
Also you should use $this->item->category->id, to get the category's id.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum