New Snippet: Mini Counter - Most popular pages

Ruud

Note that this way other pages will not be recorded at all.
If you also want to count those pages, but without display you could use:

<?php 
if (PAGE_ID == 123) {
 
MiniCounter("Hits: " " [Today: " "]" );
} else {
 
MiniCounter(0);
}
?>
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

flaens

Quote from: Ruud on December 16, 2011, 09:55:07 AM
Sure,

Just find the page_id of the page you want it to show and use:

<?php 
if (PAGE_ID == 123) {
 
MiniCounter("Hits: " " [Today: " "]" );
}
?>


thx!!!

Ruud

Sure,

Just find the page_id of the page you want it to show and use:

<?php 
if (PAGE_ID == 123) {
 
MiniCounter("Hits: " " [Today: " "]" );
}
?>
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

flaens

hi,
is it possible to show the counter just on one page?

Ruud

Just uninstall and install a fresh one.

That should do the trick
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

solbu


Ruud

No,

There is a reason this snippet is called minicounter ;-)

Have a look at this, this is a full counter with nice statistics.
Here it is explained how to use it.

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

daydreamer

Is there a way to count unique visits only , Also not count search engines

Thanks

Ruud

Quote from: vyni on October 06, 2008, 06:05:27 PM
But in fact the code generates h3.

Ooops, must have been a Freudian mistake.
I always wanted to use h2's, but for some reason I end up using h3's.  :-D

Ruud


[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

vyni

Hi Ruud,

as usual - nice thing.

So the Visitor is alway´s informed....

There is just a little mistake in the read-me. You explain:
Quote$title = The heading of the block. It is written in a <div class="popularpages"><h2> </h2></div>

But in fact the code generates h3.

regards from Himberg

erpe0812


erpe0812

Hi Ruud

that does not work for me.
Anyone who had this work?

rgds

erpe

Ruud

Hi All,

I updated the MiniCounter snippet with an extra function.

<?php Popular_Pages(); ?>

This will display a list of links (menu style) of the most viewed pages.
See the first post and the readme.txt in the .zip for more info.

Ruud


[gelöscht durch Administrator]
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

aldus

Hello Ruud

Ok - i over-read the "show_counter" sence ... :roll: (a little bit too fast ...)

Regards
Aldus

Ruud

Hi Aldus,

Some day I will post a module/snippet where you don't need to polish up anything  :-D

One modification I don't agree on.
If $show_counter = 0 we still want the page to be counting, just not output any results.
The idea is that the backend some day will get some functionality to look at the page hits.

I know this can also be done by using 3 empty params, but just a yes/no seemd more logical to me.
Adding the snippet in your template and tell it not to do anything doesn't make much sense to me.

The $page=0 test is to prevent counting hits on search results and possible other dynamic pages that should not be counted.

Cheers,

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

aldus

Hello Ruud

A nice one :-)

Only minor changes inside the include.php and index.php file


  • Add commentblock within some comments ... mostly taken from the posting of Ruud.
  • Add "if ( ($page == 0) OR ($show_counter == 0) ) return;" to get rid of the unnessesary "if" at the end of the function
  • Add a "counter_total = 0" to get a valid value in every kind of circumstances.
  • Minor code-cleaning at the end of the function.
  • Minor code-cleaning in subfunction "subItem()".
  • Add "../" inside the "index.php" to get rid of the "index.php is calling index.php is calling index.php" situation.


Regards
Aldus



[gelöscht durch Administrator]

vyni

Hi Ruud,

I didn´t know - but this is exactly what I needed.
Just a small line in the footer. Thank You.

Regards from Himberg

Ruud

#1
I created a small snippet today and called it "Mini Counter".

It does what it says. It is a simple page counter.
News/Bakery//Catalog/GoCart/Gallery subpages are counted seperately.


Installation:

Install the zipfile as a normal module through the WB backend.
Add the php code to your template index.php.


Using the snippet:

Default:  <?php MiniCounter(); ?>    

Optional parameters: <?php MiniCounter$show_counter$hits_text$today_text$closing_text ); ?>

  $show_counter = Echo the counter result (default := 1, 0 no output)
  $hits_text = The text in front of the total hits counter. (default := "Pagehits: ", if set to "" no total counter is displayed)
  $today_text = The text in front of the today hits counter. (default := " (Today: ", if set to "" no daily counter is displayed)
  $closing_text = Optional text to close the result of the snippet. (default := ")", if set to "" no closing is displayed)

Customised Example: <?php MiniCounter("Hits: " " [Today: " "]" ?>

No Output: <?php MiniCounter(0); ?>


There is no nice overview output (yet), just the counter in the page.
I invite all to build a backend page to look at stats using the data.

October 6 - Version 0.22

This version has a second snippet added.
<?php Popular_Pages(); ?>
This will create a links block with the 5 pages (or more) with the most page views.

Optional parameters: <?php Popular_Pages( $count, $title, $show_menu_title, $show_totals ); ?>

  $count = The amount of pages listed by the snippet.
  $title = The heading of the block. It is written in a <div class="popularpages"><h2><h3> </h3></h2></div>
      -- The listing itself is written in <div class="popularlist"><ul><li>........</li></ul></div>
  $show_menu_title = If set to 0 (default = 1) the page title is used for the link. Not the menu_title.
  $show_totals = if set to 1 a tooltip will be added to the link with the total pageviews for that page.


Ruud

[gelöscht durch Administrator]
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]