Keyword

Get Author items count for user page

  • Shir Ekerling
  • Shir Ekerling's Avatar Topic Author
  • Offline
  • New Member
More
10 years 3 months ago #129775 by Shir Ekerling
Get Author items count for user page was created by Shir Ekerling
Hello.
I have a website with several authors that each has many items they have wrote.

i would like to add to their page (regular k2 userpage) the number of items they have written.

how do i do that?

THANKS!!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 3 months ago #129776 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get Author items count for user page
A quick way to do this whould be to get the count() of the items.
On the user.php file try placing
<?php echo count($this->items);  ?>
where you need it appear.

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

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

  • Shir Ekerling
  • Shir Ekerling's Avatar Topic Author
  • Offline
  • New Member
More
10 years 3 months ago #129777 by Shir Ekerling
Replied by Shir Ekerling on topic Re: Get Author items count for user page
Thank you, that works great, just 1 thing - i have a pagination on this page and it counts only the items you can see per page, i whould like to make a count for all the items the user has written. how do i add this?
thank you!

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

  • Shir Ekerling
  • Shir Ekerling's Avatar Topic Author
  • Offline
  • New Member
More
10 years 3 months ago #129778 by Shir Ekerling
Replied by Shir Ekerling on topic Re: Get Author items count for user page
OK.

I have managed to also count the pagination with: ($this->pagination->total)

now, how to i combine both of them in order to count everything alltogether?
thanks!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 3 months ago #129779 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get Author items count for user page
Sorry about that.
<?php echo($this->pagination->total); ?>

indeed returns the complete item count.

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

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

  • Shir Ekerling
  • Shir Ekerling's Avatar Topic Author
  • Offline
  • New Member
More
10 years 3 months ago #129780 by Shir Ekerling
Replied by Shir Ekerling on topic Re: Get Author items count for user page
hey thanks! this gives me only the pagination, and item count gives me only the items on the page.
i need to combine them, to display the item count + the pagination count, something like
echo pagination + echo item count = what is displayed.

is that possible somehow?

thank you!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 3 months ago #129781 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Get Author items count for user page
Where exactly are you pasting this snippet?
I used it on user.php and it returned the correct number of K2 items.

I used Joomla! 2.5.22 and K2 2.6.8

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