- Posts: 214
COMMUNITY FORUM
[SOLVED] retrieve the counter of k2 items, k2 users
- George Nasis
-
Topic Author
- Offline
- Elite Member
i would like to know if there is any module to display the total number of k2 items, k2 authors and k2 comments. or if it is not possble can i take that number from the database to create a custom html module??
thank you very much
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
yes i could not find so i made one. ;)
here is the code
Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
I think you should use a module for this, not custom code, or at least use a high value for caching.
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
as you said i don`t know any module to do this job. a use a module called "flexi custom code" with which you can write your code.
what do you mean by using a high value for caching?can you explain me what should i add in the code?
thank you
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
In your global configuration enable caching and use a value like 15 - 20 mins.
Please Log in or Create an account to join the conversation.
- George Nasis
-
Topic Author
- Offline
- Elite Member
- Posts: 214
yes of course
thank you a lot
Please Log in or Create an account to join the conversation.
- laweffect
-
- Offline
- Junior Member
- Posts: 23
Please Log in or Create an account to join the conversation.
- Giovanni Ciavarelli
-
- Offline
- New Member
- Posts: 9
Sorry .. I am not able to do this! I installed flexy and Copy/Pasted the code but on the frontend it's showing the code ... not the result! :-(
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- Giovanni Ciavarelli
-
- Offline
- New Member
- Posts: 9
Unfortunately I did It but It does not work for me. Still Showing Code despite the "result"
Here I prepare custom module
i.imgur.com/PRdq1vt.png
And this is the result, on the right
i.imgur.com/Mq7ZgI5.png
Sorry, I am a noob! :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.
- Franz Wohlkönig
-
- Offline
- Platinum Member
- Posts: 529
<?php
$db = JFactory::getDBO();
$query = "SELECT COUNT(*) FROM #__users";
$db->setQuery($query);
$result = $db->loadresult();?>
<?php echo "$result" ?>
Please Log in or Create an account to join the conversation.
- Giovanni Ciavarelli
-
- Offline
- New Member
- Posts: 9
I changed this line
FROM #__k2_items";
to retrive total number of Items!
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
- Posts: 15920
Please Log in or Create an account to join the conversation.