Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Web Optimizer Plugin
Does anyone have any interest in throwing together a little plugin for the Web Optimizer . It’d be nice to have Textpattern listed under “Supported systems”.
I got the Web Optimizer setup on my server, but the last step is to integrate with your chosen php app, and that’s where I gracefully bow out.
Here is the instructions for the last step. Could this be made into a plugin of sorts without modifying core files?
How to modify your PHP file
Let's say we are modifying the wp-blog-header.php of a Wordpress blog. (This is just an example: if you want to add Web Optimizer to Wordpress you can use the Web Optimizer WP plugin). At the very top of the page you might see something like this:
<?php
if (! isset($wp_did_header)):
?>
We need to add in the Web Optimizer code before that. So you would add this to the very top of the page:
<?php
require('/PATH/TO/web-optimizer/web.optimizer.php');
?>
Finally, we must then add one more line of code to the very bottom of the page as follows:
<?php
$web_optimizer->finish();
?>
Last edited by danwoodward (2009-04-27 18:19:17)
Offline
#2 2009-04-27 17:36:16
- TheEric
- Plugin Author
- From: Wyoming
- Registered: 2004-09-17
- Posts: 566
Re: Web Optimizer Plugin
Why? Mod_gzip does an excellent job without resorting to processor intensive PHP.
Offline
Re: Web Optimizer Plugin
<txp:php>
require('/home/6440/domains/downtownmusic.dwstudio.org/html/web-optimizer/web.optimizer.php');
</txp:php>
[…]
<txp:php>
$web_optimizer->finish();
</txp:php>
Add this to the start and the footer of your page templates, respectively. Ready? Now add Textpattern CMS to the list of supported CMSs.
Offline
Re: Web Optimizer Plugin
Right, ok, with that said, and TheEric’s comment, is there actually any validity to any of the features of the Web Optimizer that aren’t already met by mod_gzip (or “php_value output_handler ob_gzhandler” if mod_gzip module is not on the server)? I mean is there a need for minified HTML if its gzipped?
Offline
Re: Web Optimizer Plugin
Guys. I’m glad that you are interested in Web Optimizer. It does not only gzip (but gzip via .htaccess directives — of course they are the best choice). If Apache doesn’t support mod_deflate + mod_filter / mod_gzip PHP does all dirty work. Initiall yproject was based on PHP Speedy but right now it differs by 90% from this plugin.
Also it merges ‘on fly’ all CSS / JS files and do some CSS Sprites (really innovative technique, I haven’t seen any other working example). Also it can add unobtrusive JS load… And so on. So it is a complex tool to speed up your website at maxium (based of course on YSlow, etc).
I will be happy if anybody can participate somehow in testing & development. You can contact me at
http://code.google.com/p/web-optimizator/
P.S. you need to include call to Web Optimzier main file (web.optimizer.php) before starting to output HTML and $web_optimizer->finish() right after all content is formed. Web OPtimzier will parse HTML and do it’s work the best.
Offline
Re: Web Optimizer Plugin
Used wet’s advice but get this error:
Fatal error: Call to a member function finish() on a non-object in /home/u71717/site.ru/www/textpattern/publish/taghandlers.php(3097) : eval()’d code on line 2
Earlier web-optimisator was installed succesfully…
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Web Optimizer Plugin
Guys! New version (in SVN) now supports Textpattern. But you can wait for approved 0.4.6 release — and download it. It will be tested through default Textpattern website.
I’ve noticed that CSS are combined somehow with PHP help. It’s very sad… It should be a static file, not dynamic one — we can put down the server w/o any caching headers for dynamic CSS file…
So Web Optimizer now handles this case properly. Also it automatically updates index.php with directives — you should only make index.php writable for it.
Offline
Re: Web Optimizer Plugin
Just a note, although textpattern does have the default option of storing the css file in the database, I never use that functionality. It just doesn’t make sense, for editing or performance. I would venture to say that a lot of txp devs and designers keep their css files static, along with their js.
Offline
Re: Web Optimizer Plugin
That’s why rvm_css was created.
Offline
#10 2009-05-14 04:29:17
- TheEric
- Plugin Author
- From: Wyoming
- Registered: 2004-09-17
- Posts: 566
Re: Web Optimizer Plugin
I personally don’t see the use in this. It might save a few ms here and there, but ultimately at the expense of server CPU. PHP isn’t all that efficient, and adding another layer of processing on top of everything else is a recipe for inefficiency. Stick with mod_gzip and you’ll be better off.
Offline
Re: Web Optimizer Plugin
@TheEric: I’m very sorry if you don’t know about clientside optimization. It’s not just GZIP. Please, Yahoo! published their rules — and almost all of them are implemented in Web Optimizer
http://developer.yahoo.com/performance/rules.html
Default CMS can be accelerated by 3-5 times only in a few clicks. And this is reality. Web Optimizer adds about 3-5% to the current HTML page generation time (after all caching files have been created) but it’s resulted in 1-5s gain for users for each page. This is especially important for e-commerce websites where every ms can be valuable.
Offline
#12 2009-05-21 12:58:18
- TheEric
- Plugin Author
- From: Wyoming
- Registered: 2004-09-17
- Posts: 566
Re: Web Optimizer Plugin
@sunnybear: at the expense of CPU cycles. Yes yes. We know this already.
TXP isn’t bloated like WP and doesn’t require these cute little tricks.
Offline