How to place blog stats on front page?

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

How to place blog stats on front page?

Post by carl_galloway » Wed Dec 07, 2005 3:19 am

Hi all,

Is there some way of putting some basic stats on the front page of my blog, such as;

1 date of last entry
2 total number of entries
3 number of comments
4 number of visitors this month or totally

I want to be able to include this in my template, and don't want to create a plugin. I think all this information should already exist within the database since I'm using the stats plugin already.

If it is possible, would I be able to create an html nugget? This wouldbemy preferred mthod, or would I need to call the serendipity hooks from within (say) index.tpl or entries.tpl.

Any help would be great.

Cheers
Carl[/list]

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: How to place blog stats on front page?

Post by garvinhicking » Wed Dec 07, 2005 11:14 am

Hi!

This won't work without creating a sidebar plugin. The statistics plugin only gathers that data on the backend, not on the frontend, so you must make a similar plugin that reads the data and prints it in the sidebar.

I've created such a plugin and committed it to SVN of the 1.0 version. You can use this plugin in your current version as well. Just download all the files from here: http://svn.berlios.de/viewcvs/serendipi ... statistics

(basically you only need the serendipity_plugin_statistics.php and the lang_en.inc.php file)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Wow, that was fast!

Post by carl_galloway » Wed Dec 07, 2005 6:09 pm

Garvin,

Thank you for that. I've installed your plugin on my site if anyone else would like to see how it looks in its defaul format.

Cheers
Carl

BabeSpot
Regular
Posts: 30
Joined: Sun Dec 04, 2005 8:42 pm

Post by BabeSpot » Thu Dec 08, 2005 3:18 am

Thnks for this plugin Garvin! I have one question; is it also possible to show how many users (visitors) there are currently at your site?
My Serendipity: BabeSpot !

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Thu Dec 08, 2005 11:36 am

I just added this function to the repository, where you can fetch it. Or download the next generated nightly tarball.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

BabeSpot
Regular
Posts: 30
Joined: Sun Dec 04, 2005 8:42 pm

Post by BabeSpot » Thu Dec 08, 2005 9:15 pm

And also a lot of thank-you's for this one Garvin !
My Serendipity: BabeSpot !

Post Reply