Keyword

Getting the number of item in a category inside item.php pag

  • Johnny Dao
  • Johnny Dao's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago #141906 by Johnny Dao
Hello all!

I'm struggling with the ITEM page (item.php file in templates folder) itself can't fetch some important data (The page that shows 1 post (item) in a category that is selected).

Now I want to display the number of items in a category that is selected in item.php file.
I found the code to display this in category.php file

<?php echo $subCategory->name; ?><?php if($this->params->get('subCatTitleItemCounter')) echo ' ('.$subCategory->numOfItems.')'; ?>

But it didn't work in item.php file

Please help me to solve this problem, Thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #141919 by Krikor Boghossian
Replied by Krikor Boghossian on topic Getting the number of item in a category inside item.php pag
This will not work inside the item.php.
The proper way to show the item's path would be by using a breadcrumbs module.
If you want to show K2's path then you need to use K2 Tools.

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

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

  • Johnny Dao
  • Johnny Dao's Avatar Topic Author
  • Offline
  • New Member
More
9 years 6 months ago #141929 by Johnny Dao
@Krikor: Thanks for helping me, but I don't want to show the item's path. I just want to show the number of items in a category in the item.php file.
If K2 don't support element to get this number, I think I need to add a querry to get it from database in model.php file and after that, push this element to item.php. But I don't know where to do this querry, just because I fear some sql injections will appear when I access K2 cores. So please let me know, thanks again.

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


Powered by Kunena Forum