Keyword

display second level of sub cat

  • yannick berges
  • yannick berges's Avatar Topic Author
  • Offline
  • Senior Member
More
7 years 1 month ago #161180 by yannick berges
Replied by yannick berges on topic display second level of sub cat
Solution
<ul class="destinations">
                     <?php 
        $id = (int)$subCategory->id;
//echo 'id'.$id;
		$db = JFactory::getDBO();
		$query = "SELECT * FROM #__k2_categories  WHERE parent={$id} AND published=1 AND trash=0 ORDER BY name";
        $db->setQuery($query);
		$rows = $db->loadObjectList();
//echo '<pre>'.print_r($rows).'</pre>';
                    foreach ($rows as $value){
                        echo '<li><a ref="index.php?option=com_k2&view=itemlist&layout=category&task=category&id='.$value->id.'">'.$value->name.'</a></li>';
                    }
               
?>
                
                    </ul>

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
7 years 1 month ago #161189 by Krikor Boghossian
Replied by Krikor Boghossian on topic display second level of sub cat
This will not follow the menu items nor will it produce SEF links, so I would recommend using the K2 Tools or a menu module instead.

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