Keyword

Display hits counter in tag pages

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 8 months ago #108809 by Matt
Display hits counter in tag pages was created by Matt
I tried for hours to make article hits display in tag pages, but I failed. The tag page doesn't except the hits parameter. When I insert this in the tag.php:
<?php echo $this->item->hits; ?>

I get these warnings:

Notice: Undefined property: K2ViewItemlist::$item in C:\xampp\htdocs\joomla\templates\mytemplate\html\com_k2\templates\default\tag.php on line 49

Notice: Trying to get property of non-object in C:\xampp\htdocs\joomla\templates\mytemplate\html\com_k2\templates\default\tag.php on line 49


Line 49 is the line I posted above. Any suggestions?

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

  • Matt
  • Matt's Avatar Topic Author
  • Offline
  • Senior Member
More
11 years 8 months ago - 11 years 8 months ago #108810 by Matt
Replied by Matt on topic Re: Display hits counter in tag pages
I resolved it. You need just to remove the $this variable. The working line is this:
<?php echo $item->hits; ?>

Strange enough, this doesn't work with author names.

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


Powered by Kunena Forum