The caching plugin I pointed to the other day was very well-executed but it didn’t meet my needs for several reasons, mainly that it cached every bit of output, which wouldn’t be appropiate for things like my random photo. (Or my non-rotating photo formerly known as the random photo in the header. It’s on break right now.) My site is a pretty neat system of PHP includes, and I want to preserve that because it makes my life easy and doesn’t slow anything down any perceptable amount.
So I took the Staticize plugin and added support for dynamic non-cached sections, cleaned up the code a bit, fixed a weird problem where it would just show a blank page if it couldn’t write the file, fixed the problem with edit links and the comment form, and made it fit with the WordPress code a little smoother. Full instructions are included with the plugin, but to install just make sure your wp-content
folder is writable (you may have already done that when setting up WP) and activate the plugin, and it will start working immediately.
I have a couple more improvements in mind for it already, but it’s fully functional and I’m running it right now.
[…] […]
[…] Mikeluæ–°çš„æ–‡ç« ä¸æŽ¨è了两ç§ï¼Œä¸€ç§æ˜¯Matt写的staticize的工具,å¦ä¸€ä¸ªæ˜¯jens写的Prerendering工具 […]
Sounds great, I will try this out!
Cool. I personally prefer plugins to includes, so I added a line to your code to allow me to exclude a function from the case as well as a include:
$store = preg_replace('|<!--fclude (.*?)-->(.*?)<!--/fclude-->|s', '<?php $1 ;?>', $buffer);
Then in my template I use the syntax:
<!--fclude heldomatic() -->
<?php heldomatic(); ?>
<!--/fclude-->
Seems to work.
Well I suppose it could be easily modified to allow any PHP code, but because it’s included from inside a function every variable that was used would have to be explicitly global.
This sounds really nice. I’ll have to implement it on my site. I find that WordPress is quite easy on my machines load average though.
Should I should exclude the following items:
– Related posts plugin
– Google AdSense
Mojo, those should be fine if cached.
heh – make that <!– Dynamic Page Served (once) in 0.209 seconds –>
<!– Static Page Served in 0.003 seconds –> (php in comments = blank space…)
Still invalidates my pages when I use it. Is there something in the
head
section that I should be implementing with php includes?Dowingba, how does it invalidate your pages?
As far as I can tell, all the trackback rdf info shows up as invalid for some reason when I use the plugin (and the original version of the plugin). I deactivate the plugin and all is well. I’m assuming there’s some snippet of code in the
head
somewhere that isn’t being cached/served and the rdf stuff depends on it somehow.This is probably a php/fopen thang, but I noticed that if a parent directory is not world readable (even if +x), the script fails and says that it can’t create the temp files (although it creates the wp_content/cache dir just fine).
I am far from a php guru, but thought i’d mention that I had to chmod o+r all the way down my dir tree in order for this plugin to work (all previous plugins seemed to work okay before *shrug*).
Doesn’t this result in the cache directory becoming full of files that aren’t used (older versions of pages)?
Does not play well with AK’s ‘New Since Last Visit’ plugin.
Hrm. I’m running into a problem with the required include file (for blogrolls) being cached as well. The output isn’t updated unless a new comment or entry is added in WP and it should be dynamic.
In my index.php file I have a require in there pointing to my blogroll:
blogroll.php contents are simply:
Any ideas if I missed something or am doing something wrong? If I shut off the caching plugin, it updates properly.
Thanks!
Hrm. Code seems to have been stripped out of the above comment when surrounded by code tags. I’ll try again:
index.php:
<?php require ‘includes/blogroll.php’; ?>
blogroll.php:
<?php wp_get_links(1); ?>
You might want to do something about caching pages before they are gzipped. I think I’ll turn on mod_compress to get around this issue.
This is excellent, I must say. The benefits of static pages without the pain of republishing.
One issue however: it doesn’t appear to rebuild pages when a trackback comes in. I’ve tried this on a couple of WP installations, and it seems to be consistent in this.
I have a problem when using Staticize Reloaded plugin provided with the 2004.08.30 nightly build of WordPress. WordPress is installed into a different directory using this method: different address.
The “different address” hack works without the plugin activated. When activated, I have this error message:
Any ideas?
The exclude syntax doesn’t work with BBClone Stats. Tested on three blogs. Nonetheless still very cool.
After installing it, everything seems cool, although my RSS feed doesn’t appear to refresh. Is there a workaround? I’ve checked in two different readers (Firefox live bookmars, and RSS Bandit). Since I activated the plugin neither has received anything new.
Getting:
Parse error: parse error in /web/script/skallas/nerdfilter.com/wp-content/cache/2d1279da46f6ac2c2771aecbcdd1ec0e.php on line 1
I found an important concurrency bug: if more than a client access to the same page, the same content could be appended several times to the same cache file.
It’s repeatable by using Apache Benchmark (ab).
Ricardo, I’ll look into that.
This plugin has successfully turned my WP pages into gibberish 50% of the time. In Opera and Firefox both. Sometimes refreshing it fixes it, and sometimes it doesn’t.
Anyone else have this problem?
That’s usually a problem when you don’t turn gzip off like the instructions say.
This plugin has been updated here:
http://mnm.uib.es/gallir/wp-cache-2/
If you’ve had problems with it (my RSS was breaking for instance), you might want to try the latest version.
No thanks, i think i’ll stay away from something that can wreak havoc and bust your set up just to save a few miliseconds of time that you can do easily by just trimming the fat off the site. Laziness can make more trouble than using a little effort.
Still, hope you guys finally work it out.