Creating Most Read/ Commented List
Permalink 1 user found helpful
BACKGROUND:
I'm currently trying to pull a list of pages (say top 10) which by site statistics are most read/ commented by visitors.
QUESTION:
1. Is there a database table in C5 which compiles page visits?
2. Is there a function which can parse the raw access logs for visits per page?
NOTE:
I recently readhttp://www.concrete5.org/community/forums/usage/page-list-popular-p...
However, when looking in the C5 database I couldn't find the table "cv" (table CollectionVersions exists though).
3. Any ideas how to enable this table (cv) if possible?
I recon comments could be totalled using:
Thanks in advance for any help!
I'm currently trying to pull a list of pages (say top 10) which by site statistics are most read/ commented by visitors.
QUESTION:
1. Is there a database table in C5 which compiles page visits?
2. Is there a function which can parse the raw access logs for visits per page?
NOTE:
I recently readhttp://www.concrete5.org/community/forums/usage/page-list-popular-p...
However, when looking in the C5 database I couldn't find the table "cv" (table CollectionVersions exists though).
3. Any ideas how to enable this table (cv) if possible?
I recon comments could be totalled using:
Loader::controller($PageObject)->getCommentCountString('%s')
Thanks in advance for any help!
heh, never mind - pretty blind sometimes. theres a big fat table labled "PageStatistics" which I somehow missed!
Think I've got it for most popular. The dashboard seems to rate a visit when "uID" from the table PageStatistics = 0. So I wrote for my query:
On a modification from the earlier link.
Seems to work fine. If there's a glaring mistake someone tell me.
On a modification from the earlier link.
Seems to work fine. If there's a glaring mistake someone tell me.
Also for the comments list it's simply:
This collects info from the btGuestBookEntries table. Data's already filtered only for blog posts in there.
<?php defined('C5_EXECUTE') or die(_("Access Denied.")); $limit = $num ? $num : 5; $mrSql = "SELECT cID, commentText, entryDate FROM btGuestBookEntries ORDER BY entryDate DESC LIMIT $num"; Loader::model('page_list'); $db = Loader::db(); $pageList = $db->execute($mrSql); echo '<h2>Recent Comments</h2>'; while ($pg = $pageList->fetchRow()) { $curPage = Page::getByID($pg[cID]); echo '<a href="'.$this->url($curPage->getCollectionPath()).'">'.$pg[commentText].'</a><br/>'; }
This collects info from the btGuestBookEntries table. Data's already filtered only for blog posts in there.
thanks cowland, this thread very helpfull to me.
thanks for sharing :)
thanks for sharing :)
I tried to pull up the Recent Comments by creating a template for the pagelist block using this but the comments don't seem to show up !!