Keyword

K2 Content - Show only Items from Current Cat Id

  • Evodia
  • Evodia's Avatar Topic Author
  • Offline
  • New Member
More
10 years 5 months ago - 10 years 5 months ago #127154 by Evodia
Hi,

I'm using Modules Anywhere to display a module named 'Related Items' in my aside.

The K2 Content Module I didnt set any category or page to show.

Turns out that module is showing only last items from a category.. I think the parameter 'category_id' isn't working..

Does anyone know how to fix it?

I just want to show related items from the current category!


My code:

<?php
//Return K2 Item ID
$itemId = JRequest::getInt('id');

//Return K2 Item Category
$db = JFactory::getDBO();
$query = "SELECT catid FROM #__k2_items WHERE id = '$itemId'";
$db->setQuery($query);
$result = $db->loadResult();
?>

<!-- Load Module -->
{module Related Items|category_id=<?php echo $result; ?>}

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

More
10 years 5 months ago #127155 by Lefteris
Hi. I suggest that you create a module position and then create a module instance there with the desired settings. Then just load the position.

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