HitCounter extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

HitCounter extension

Postby marcelfw » Wed Nov 10, 2010 3:48 pm

This is the forum topic for the new HitCounter extension.

HitCounter is an extension to create top-X lists of entries or pages in your site.
It keeps track of hits for the last_week and for last_month.

It requires a modern PivotX (version 2 and up) and a SQL database.
It has a limited design scope, meaning it's meant for creating top lists. It's not a generic PivotX statistics tool.
marcelfw
 
Posts: 44
Joined: Wed Nov 10, 2010 3:40 pm

Re: HitCounter extension

Postby jadwigo » Wed Nov 10, 2010 3:52 pm

If you're using pivotx without a mysql database you can try if the WZUP extension is suitable for you.
http://extensions.pivotx.net/entry/18/wzup
viewtopic.php?f=10&t=551
My pivotx playground is at http://jivotx.twokings.eu - the rest is at http://www.jadwigo.nl
jadwigo
Developer
 
Posts: 117
Joined: Wed Nov 18, 2009 9:49 am
Location: Den Haag, Netherlands

Re: HitCounter extension

Postby roelfina » Tue Jan 18, 2011 2:15 pm

I would like to use HitCounter to give a list of the entries best watched on my blog in this style:

Title entry - No. of Hits

Is there someone who knows the code for this, cause showing the number of hits isn't shown as an example in the documentation of the extension.

I now have this:
Code: Select all
[[top_entries assign='topentries']]

          <ul>
            [[foreach from=$topentries item='topentry']]
            <li><a href="[[$topentry.link]]">[[$topentry.title|escape]]</a></li>
            [[/foreach]]
          </ul>


Which only shows a list of topentries and not the number of hits. It's for my website: http://roelfina.net (the stats are now showing on the right bottom side of the page "Best bekeken".
roelfina
 
Posts: 13
Joined: Wed Jul 02, 2008 11:06 am
Location: Enschede, The Netherlands

Re: HitCounter extension

Postby marcelfw » Tue Jan 18, 2011 2:41 pm

Within the [[foreach]] you can access the number of hits by using [[$topentry.hits]].

It is documented but I can imagine it would be handy to have a working example to do it. I will update the documentation with such an example.
marcelfw
 
Posts: 44
Joined: Wed Nov 10, 2010 3:40 pm

Re: HitCounter extension

Postby roelfina » Thu Jan 20, 2011 1:02 pm

Thank you very much. This code works:
Code: Select all
[[top_entries assign='topentries']]
<ul>
[[foreach from=$topentries item='topentry']]
<li><a href="[[$topentry.link]]">[[$topentry.title|escape]]</a> - [[$topentry.hits]] keer bekeken</li>
[[/foreach]]
</ul>
roelfina
 
Posts: 13
Joined: Wed Jul 02, 2008 11:06 am
Location: Enschede, The Netherlands

Re: HitCounter extension

Postby Gerard113 » Sun Jan 22, 2012 11:11 pm

I like this extention very much but i wonder:

Is there a way to show the category in a list of entries?

I use this code:

Code: Select all
[[top_entries assign='topentries' limit='30'  filter='last_week']]
<ul>
[[foreach from=$topentries item='topentry']]
<li><a href="[[$topentry.link]]">[[$topentry.title|escape]]</a> - ( [[$topentry.hits]] ) </li>
[[/foreach]]
</ul>


Greetings,

Gerard
Gerard113
 
Posts: 183
Joined: Fri Aug 07, 2009 9:58 pm
Location: nederland

Re: HitCounter extension

Postby hansfn » Mon Jan 23, 2012 8:10 am

$topentry contains everything $entry contains in a subweblog. In other words, $entry.category should give the entry's categories.

OK, this was wrong. I had never used the extension and didn't read the documentation before answering. I read it now and it says:

The variable ($topentry) contains an array where each index contains basic entry or page information. Namely 'uid', 'title', 'uri', 'date' and 'link'. This should suffice in most case, please use `[[getpage]]` or `[[getentry]]` to get more information.


So why didn't you just use getentry? You didn't understand or you also failed to read the documentation? In case you didn't understand, here is an (untested) example:

Code: Select all
[[top_entries assign='topentries' limit='30'  filter='last_week']]
<ul>
[[foreach from=$topentries item='topentry']]
    [[ getentry uid=$topentry.uid var=fulltopentry ]] 
    <li><a href="[[$topentry.link]]">[[$topentry.title|escape]]</a> - ( [[$topentry.hits]] ) -
        posted in [[ category name=$fulltopentry.category ]]
    </li>
[[/foreach]]
</ul>
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: HitCounter extension

Postby Gerard113 » Mon Jan 23, 2012 9:45 pm

Hans,

Sorry i did not understand that. I can use Pivotx but i am not a programmer. that why i asked how to do it. Cay you advise me a site where i can learn how to programm there things? sometimes i use the structure of some solutions form the forum, and try if there will work for me.

Greetings,

Gerard
Gerard113
 
Posts: 183
Joined: Fri Aug 07, 2009 9:58 pm
Location: nederland

Re: HitCounter extension

Postby hansfn » Mon Jan 23, 2012 11:09 pm

Did my solution work for you? It's OK to not understand everything ;-)

To understand these thing better, you need to read the Smarty documentation, Smarty is the PivotX templating language, and of course the PivotX specific Smarty tag documentation.
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: HitCounter extension

Postby Gerard113 » Tue Jan 24, 2012 11:35 am

Sorry, yes your (untested) example workted, just as i wanted.

I will look into the Smarty documentation and try to understand the coding.

Greetings,

Gerard
Gerard113
 
Posts: 183
Joined: Fri Aug 07, 2009 9:58 pm
Location: nederland

Next

Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 2 guests

cron