Part of the EllisLab Network
pMachine Pro has been replaced by ExpressionEngine, our full featured web publishing solution. Please consider upgrading.
You can download pMachine Pro here: Download pMachine Pro  |  Download Language Packs
   
 
Add a cache for your more pages
Posted: 30 May 2007 04:35 PM   [ Ignore ]  
Summer Student
Total Posts:  25
Joined  2005-12-31

It ain’t simple, but it does work.

1) Get Lite.php from http://pear.php.net/package/Cache_Lite

2) Edit Lite.php and replace all instances of $id with $cid.

3) Upload Lite.php to your server directory and make sure it remains as Lite.php.

4) Create a directory named cache and CHMOD it to 777.

5) Edit your more.php file to add these lines at the beginning:

<?php
include("pm_inc.php");
require_once("Lite.php");

// set an ID for this cache
$cid = get_id($id, "1");

// set some variables
$options = array(
// cacheDir should be the absolute address of your files on your server**
// this will vary wildly depending on the server configuration
'cacheDir' => '/home/myaccount/mydomain/cache/',
'lifeTime' => 50
);

// create a Cache_Lite object
$objCache = new Cache_Lite($options);

// test if there exists a valid cache
if ($quote = $objCache->get($cid))
{ echo $quote; }
else
{
echo $quote;
$objCache->save($quote, $cid);
}
?>

**If you don’t know this, just comment out the last } in the code upload the file and run it one time, the error message will let you know :=) Copy the path and insert it into your more.php file, don’t forget to fix the broken line.

Your server needs the Pear module installed (it probably will be).

This probably won’t work if you are on a WinDoes server.

If you have multiple weblogs on your site, some tuning will be required :=)

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 233, on December 18, 2007 12:04 AM
Total Registered Members: 55803 Total Logged-in Users: 0
Total Topics: 63629 Total Anonymous Users: 0
Total Replies: 342814 Total Guests: 29
Total Posts: 406443    
Members ( View Memberlist )
Newest Members:  Aaren HofferthYepurijolyITCANEIn-CognitoAndy@F1btwilkinsdhiliusitionsuoxinjacksonj04
Active Members: