Keyword

Hits counter when using Jotcache

More
11 years 2 days ago #128591 by Lefteris
Replied by Lefteris on topic Re: Hits counter when using Jotcache
You also need to set "Parse PHP code" to "yes".

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

More
10 years 6 months ago #134330 by Andi Setyaji
Replied by Andi Setyaji on topic Re: Hits counter when using Jotcache
Sorry, I am new in K2 and Joomla. I also had the same problem.
May I ask, where the code is entered?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
10 years 6 months ago #134341 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Hits counter when using Jotcache
In the item.php.
More information on overrides can be found here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

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

More
10 years 6 months ago - 10 years 6 months ago #134359 by Andi Setyaji
Replied by Andi Setyaji on topic Re: Hits counter when using Jotcache
Thanks for your reply Mr. Krikor. Sorry, I still do not understand. I use K2 v.2.6.8, joomla v 2.5.27. Where the line, code is inserted?

My regards,
Andi
Last edit: 10 years 6 months ago by Andi Setyaji.

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

More
10 years 1 month ago #142946 by Martin
Replied by Martin on topic Hits counter when using Joomla Cache
Hi,

i read the answers thoughtfully but it doesn't work.

I copied the code into the K2 Tools module, php execution setted to yes. Module is published and has a position. Then i have activated the Joomla cache (normal) and the hit counter comes to a halt.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145706 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Re: Hits counter when using Joomla cache

Krikor wrote: In the item.php.
More information on overrides can be found here: getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates


Dear mr Krikor

The whole topic is a bit vague

It seems that K2 hits counter is not working when using joomla cache. Is there a simple, step by step way to actually make it workng?

if you say "add the code in item.php" then you just don't know what to do!

I need the information to provide popular items lists and similar statistics in my site.

I tried to use the code below
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

if (isset($_GET['view']) && strtolower($_GET['view']) == 'article') {
 $articleId = (int) $_GET['id']; 
  
 $db = JFactory::getDBO();
 $db->setQuery(
                        'UPDATE #__content' .
                        ' SET hits = hits + 1' .
                        ' WHERE id = '.(int) $articleId
                );
 $db->query(); 
}

?>

in item.php but no luck. Please since it seems that this is an issue that has been haunting K2 for some time now, could you please help us solve it by providing a step-by-step instruction set?

if that includes adding jotcache, I don't mind, however at the moment jotcache is not installed on my website. (www.coffeespots.gr)

Thank you.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145710 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Hits counter when using Joomla cache
Since I do not know what to do, you can read the thread from the start, or you can try to be more polite.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145718 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Re: Hits counter when using Joomla cache

Krikor wrote: Since I do not know what to do, you can read the thread from the start, or you can try to be more polite.


Dear mr. Krikor

I was not trying to be rude.

Let me take my reply step by step:

The whole topic is a bit vague

I certainly did not mean that it's a bit vague because of you. I just pointed out that posts in this topic (which I've read from the beginning) do not cover in full the steps that need to be taken in order to get to a solution

if you say "add the code in item.php" then you just don't know what to do!

mmm... I guess you are right to be offended by that. However I did not really mean that "you" mr. Krikor do not know stuff. I suppose the sentence sounded better in my head but my english make it sound a bit rude and point you out as the one to blame. Please accept my apologies for that and let me rephrase:

if you say "add the code in item.php" then the person who tries to follow that instruction just won't know what to do!
Do you mind helping out in implementing that?

I any case I did not mean to insult you. I just figured that you seem like one who actually could easily provide a simple solution for "the counter not updating with cache turned on" issue.

Please accept my apologies again and if you could help out, I'd appreciate your feedback.
Otherwise let it all be well and once I've figured it out, I will post it here and urge the developers to add the update to the next version.

P.S. Joomla core article system's hit counter is not affected by cache.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145736 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Hits counter when using Joomla cache
It's ok :)

The code should be pasted on a K2 Tools Module.
PHP parsing must be enabled.

Finally this module should NOT be cached. Disable caching from the module's params and if Jotcache offers an additional caching layer, exclude it from there as well.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145738 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Hits counter when using Jotcache
Ok so I publish this thing on Every page?

Or just the menu items for each K2 category?

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145755 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Re: Hits counter when using Joomla cache
Thank you for that.

However It did not work for me. I actually have the module published as we speak below the k2 article content right above the footer position. I've used the mainbottom-a postition and selected to hide the title. You can see in page: www.coffeespots.gr/hot-news/item/515-new-horizons that it's not working. Am I doing something wrong?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145758 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hits counter when using Jotcache
Wherever K2 items are present. If you have mapped all of your K2 categories into menu items, you can only publish it on those menus.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145759 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Hits counter when using Jotcache
Yes. I've done so.

I also had the title shown to be sure that it was correctly published The title appeared right below the article content. However the counters would not update. Right now the module IS published but I changed the title from show to hide because it's a live site.

is there a way to troubleshoot this?

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145761 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hits counter when using Jotcache
Is the Parse PHP code setting set to Yes?

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145762 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Hits counter when using Jotcache
Yes.

I have attached a screeshot. Does it look ok?

i.imgur.com/Mdn6ZFs.png

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145783 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hits counter when using Jotcache
The screenshot looks fine and these settings are correct.
Make sure that this module is not being cached. By default this setting is located in the module's advanced setting.

Keep in mind that I do not know if Jotcache caches modules as well. This is something you need to look into it.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago - 9 years 10 months ago #145784 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Hits counter when using Jotcache
Yes I had that in mind but no. It's not cached.

Besides I do not use Jotcache. Only normal joomla cache.
Last edit: 9 years 10 months ago by Alexandros Androutsos.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #145791 by Krikor Boghossian
Replied by Krikor Boghossian on topic Hits counter when using Jotcache
This code which is from Joomla!'s forum indicates that it does not work wih system cache.

"There is a hack that works with Conservative and Progressive cache but not with System Cache."

The hits are counted but they are only displayed when cache is cleared. Make sure that this is not the case with your site.

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

  • Alexandros Androutsos
  • Alexandros Androutsos's Avatar
  • Offline
  • New Member
More
9 years 10 months ago #145799 by Alexandros Androutsos
Replied by Alexandros Androutsos on topic Hits counter when using Jotcache
I'm using progressive caching. What is the "system cache"? Is it the cache plugin in plugins?

I check the counters from the backend not the frontend so they will not change when cache is cleared. I've also tried to check the db but I see that the db is not updated so clearing the cache will not produce anything new.

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

More
9 years 9 months ago #146363 by NormanBLN
Replied by NormanBLN on topic Hits counter when using Jotcache
Hello,
I have the same problem - is the joomla cache on, is the visitor counter off :(

We do what you wrote:
1) New modul 'K2 Tool'
2) copy our JavaScript inside
3) set on Parse PHP-Code" on "yes" and excluded the caching from this modul
4) we set the modul on a frond end modul position
(yes, modul is on 'public')

What can we do?

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


Powered by Kunena Forum