solved Starting blog view count problem

alt=
K_K
@k-k
last year
88 posts
I have succesfully added a blog view count to one Jamroom website earlier and now I am doing same thing to another one, but running into trouble. It has been several years, so not sure what I am missing.

As per this thread https://www.jamroom.net/the-jamroom-network/forum/suggestions/42409/item-view-count I have added...

{jrCore_counter module="jrBlog" item_id=$item._item_id name="blog_view"}

...to blog modules item_detail.tpl template.

Saved changes and cleared caches.

I was remembering the count would start automatically and "blog_view_count" would appear in the datastore item after first view, but it is not happening.

What I might be missing?

updated by @k-k: 07/11/23 06:04:53AM
michael
@michael
last year
7,692 posts
Where you have:
{jrCore_counter module="jrBlog" item_id=$item._item_id name="blog_view"}
Add a debug in:
{jrCore_counter module="jrBlog" item_id=$item._item_id name="blog_view"}
{debug}

when you go to the page a new window will pop up with all the avaliable variables at that location. Check that $item._item_id is one of the available variables.

That needs to be set to whatever the item_id of the blog post is.

Here's the docs on debug:

Docs: {debug}
https://www.jamroom.net/the-jamroom-network/documentation/module-developer-guide/1477/debug
alt=
K_K
@k-k
last year
88 posts
Thanks for info.

The console does not open for me, using latest Firefox. Tried enabling developer mode, but that did not help either.

I copied the

{jrCore_counter module="jrBlog" item_id=$item._item_id name="blog_view"}


from my other Jamroom site, so it feels strange it works there but not on the new site.
michael
@michael
last year
7,692 posts
Agreed, if you put it in exactly the same file in exactly the same place then it should work exactly the same.

That the {debug} is not opening suggests that the edit has not taken effect. Try resetting the caches

ACP -> MODULES -> CORE -> SYSTEM CORE -> TOOLS -> RESET CACHE

then check the page again. You might have to click a button in firefox "allow popups from this site" which will appear in the top right if you have popup blocker setting on which is usually the default.

Maybe also try adding some text "Here is some text so I can see the file has changed Avacardo, Apples, Whatever".

If you CAN see the text then you know the {debug} is in there too.
alt=
K_K
@k-k
last year
88 posts
Got it sorted.

In the new site I am using the Fan Club skin. For some reason it has jrBlog_item_action.tpl in the skin templates that seems to rule over the blog module item_detail.tpl.

After adding the code to the skin .tpl everything is working smoothly.