phpWebSite Manual
phpWebSite Manual

phpWebSite Resources

Mods

3rd Party Mods

Who's Online
There are currently, 7 guest(s) and 0 member(s) that are online.
You are an Anonymous user.
You can register for free by clicking here
No Members are currently logged in.

Announcements

Adding Pagemaster stats collection to 0.10.0

Posted by: Buzz on 11/26/2004 07:03 AM (Read: 1320)

The lastest version of phpWebSite (0.10.0) contains a new module - allowing for the collection and display of stats. However, it currently doesn't support collection from the PageMaster (Web Pages) Module. I created a hack designed to give you the ability to add this function.

The current stats system interacts with standard modules (announcements, users, comments etc), but doesn't with PageMaster. The following hack creates the necessary links to the stats system. This has been checked against 0.10.0RC1 and should work with 0.10.0 (no changes made between RC1 and final).

1. Modify your database!

Using your favourite database editor, add the following field to your mod_pagemaster_pages table:
Field: hits
Type: int
Default: 0 (zero)

2. Modify Page.php (mod/pagemaster/class/Page.php)

Add the following variable to the vars list:
Code:
var $_hits = 0;

Include the new data field in the results:
Code:
$this->submitted = TRUE;
$this->_hits = $result[0]["hits"]; // Add this line!

Insert the following function at the end of the file:
Code:
function hit() {
$this->_hits++;
$data["hits"] = $this->_hits;
$GLOBALS["core"]->sqlUpdate($data, "mod_pagemaster_pages", "id", $this->id);
}
// Make sure the function appears before
}// END CLASS PHPWS_Page

3. Modify index.php (mod/pagemaster/index.php)

Add the indicated lines to the case "view _page":
Code:
case "view_page":
if (isset($_REQUEST["PAGE_id"])) { // Add the opening brace
$_SESSION["SES_PM_page"]->hit(); // Add this line
$_SESSION["SES_PM_page"] = new PHPWS_Page((int)$_REQUEST["PAGE_id"]);
} else { // Encase the else in braces
$_SESSION["SES_PM_page"] = new PHPWS_Page();
} // Close the brace!


4. Modify stats.php (mod/stats/class/Stats.php)

Add the indicated line in the defines:
Code:
define("ANN_TABLE", "mod_announce");
define("PM_TABLE", "mod_pagemaster_pages"); // Add this line
define("LINKS_TABLE", "mod_linkman_links");


Add the indicated lines to function setup():
Code:
if($GLOBALS["core"]->moduleExists("announce"))
$topTen[ANNOUNCEMENT_SUBMITTERS] = $_SESSION["translate"]->it("Most Active Announcement Submitters");

if($GLOBALS["core"]->moduleExists("pagemaster")) // Add this line $topTen[PAGEMASTER_PAGES] = $_SESSION["translate"]->it("Most Viewed Web Pages"); // Add this line

if($GLOBALS["core"]->moduleExists("linkman"))
$topTen[LINKS] = $_SESSION["translate"]->it("Most Visited Links");


After the _getTopAnn function, add the following function:
Code:
function _getTopPM() { // Function Added for Pagemaster Stats $topPagemaster = $GLOBALS["core"]->sqlSelect(PM_TABLE, array("approved"=>1,"active"=>1), NULL, "hits DESC", NULL, NULL, $this->_numStats);

if($topPagemaster || $this->_showEmpty) {
$tags["STAT_ITEM_TITLE"] = $_SESSION["translate"]->it("Top") . ' ' .$this->_numStats . $_SESSION["translate"]->it(" Most Viewed Web Pages");
$tags["STAT_ITEM_LISTINGS"] = "";

if(!empty($topPagemaster)) {
foreach($topPagemaster as $page) {
$itemTag["ITEM"] = PHPWS_Text::moduleLink($page["title"],
"pagemaster", array("PAGE_user_op"=>"view_page", "PAGE_id"=>$page["id"]));

$itemTag["ITEM_COUNT"] = $_SESSION["translate"]->it("Views: ") . $page["hits"];
$tags["STAT_ITEM_LISTINGS"] .= PHPWS_Template::processTemplate($itemTag, "stats", "stats/view/listing.tpl");
}
}

return PHPWS_Template::processTemplate($tags, "stats",
"stats/view/stat_item.tpl");
}
} // End Pagemaster Stats Function


Finally, add the indicated lines (should be around line 458:
Code:
if(strpos($show[0]["stats_viewable"], (string)COMMENTED_ANNOUNCEMENTS) !== FALSE
&& $GLOBALS["core"]->moduleExists("comments"))
$tags["STATS_ITEMS"] .= $this->_getTopCommentedAnn();

// Add the following lines
if(strpos($show[0]["stats_viewable"], (string)PAGEMASTER_PAGES) !== FALSE
&& $GLOBALS["core"]->moduleExists("pagemaster"))
$tags["STATS_ITEMS"] .= $this->_getTopPM();
// End inserted lines

if(strpos($show[0]["stats_viewable"], (string)LINKS) !== FALSE &&
$GLOBALS["core"]->moduleExists("linkman"))
$tags["STATS_ITEMS"] .= $this->_getTopLinks();

That should do it! Now all you need to do is visit the Stats page, select Settings, and add Most Viewed Web Pages to your stats!

Updated by: Buzz on 11/26/2004 07:03 AM
Expires: 01/01/2009 12:00 AM
Printable Version

Comments - Please Log In to make a comment
The comments are owned by the poster. We are not responsible for its content.
Web Stats
Posted on: 12/05/2004 01:19 PM   By: Anonymous
Very sweet, and easy to make the changes!
Thanks a lot!
- David
powerleveling: coolingame.com
Posted on: 11/03/2008 11:31 PM   By: leveln
Horde Leveling Guide
This wow power leveling guide starts at level 21, if you need wow powerleveling guides for any other powerleveling level range (from 1-21 for example) please take a look at this power leveling page.
This wow power level guide is optimized for FAST leveling with a minimum of grinding sessions. wow powerlevel Quests are important, they give rewards and faction and are less boring than pure wow powerleveling grinding, BUT sometimes some quests are really a time waste and we will skip those and replace them by good wow power leveling grinding session when it is necessary.
Some people say that wow power leveln grinding is always faster than questing, this is true in theory when you don't know which wow powerleveln quests to take and which to avoid, and what is the best order to do them. With this fiesta online guide, questing will be very efficient and much better than pure grinding. Follow each fiesta online instruction carefully and you will see for yourself.
The last chaos quest choices and order to do them are optimal so that you run as few as possible while doing the most possible and then turning several last chaos gold quests in at the same time. This lastchaos gold guide will be very useful for both veteran and novice players. I try to keep the amount of last chaos gold information as short as possible. So even the guide itself is optimized for the minimum reading possible, to save time! Let's get started immediately then! Everything described in this lastchaos gold guide can be done solo (besides when I say otherwise). However you can follow this guide while duoing, grouping, it's not a problem, it works too.

wow power leveling
wow powerleveling
powerleveling
power leveling
wow power level
wow powerlevel
No Subject
Posted on: 12/29/2004 04:33 PM   By: singletrack
Darren has added pagemaster stats into cvs now btw.


Sponsored by Patterson Research
Founded by Robert Kennedy
Powered by phpWebSite