Hi,
I’m performing some optimizing of a website.
I’ve found out that using the mod_gzip module with Apache will decrease the load of HTML and CSS alot.
And I can really recommend it to everyone! It really works great. (check the header of mod_gzip for example)
But it dosn’t seem to work with content from Matrix. An easy way of checking if mod_gizip is working is to check the header for a webpage and specially for the content-typ, which should be gzip.
How is this implemented in Matrix? Aren’t all content sent to apache in a normal way, or are Matrix setting its own header, which I think will override this feature.
For me this module would be a great performance booster, since just the HTML & CSS files of my pages are about 250K. (thanks to a anti-performance-navigation)
Regards,
Daniel
[quote]How is this implemented in Matrix? Aren’t all content sent to apache in a normal way, or are Matrix setting its own header, which I think will override this feature.
[right][post=“9060”]<{POST_SNAPBACK}>[/post][/right][/quote]
You need to configure mod_gzip to compress the output from PHP scripts, which is doesn’t do by default. Check the mod_gzip documentation for instructions on how to do this.
However, I would also recommend that you tell you client just how bandwidth unfriendly their navigation seems to be. 
Hehe… it's politics!
Thanks for the advice!
By the way, if I activate the cache for the navigation in the designs, how long does it take to refresh that cache? Is it the same value that are set in the Cache manager?
[quote]By the way, if I activate the cache for the navigation in the designs, how long does it take to refresh that cache? Is it the same value that are set in the Cache manager?
[right][post=“9065”]<{POST_SNAPBACK}>[/post][/right][/quote]
Yup.
Rodger that.
Seems like mod_gzip cant handle PHP content. Or I've not found any info about that yet. What it can do is to compress content due to the mime encoding. Will try that.
Ok, got it working.
using a matching for mime type text/.* all text will be compressed.
Shit this is good: My html + css size went from over 200K to only 80K thats a recommend!!!!
Avi! One thing happend after turning on cache manager. Have a look at: strange error message
The page is a custom made asset for pressreleases. I think it has to do with how this asset was made.
What you can see is that the page has jumped down. Check the source and you see an error message from matrix telling “PHP Notice” whats this about?
Yup, looks like your custom asset is not coded correctly. Without seeing the source code of the asset, there's no way of telling what is causing that error. The error is "Object to string conversion".
It do work when not using cache.
This is management file:
class Pressmeddelande_Management extends Asset_Management
{
/**
* Constructor
*
*/
function Pressmeddelande_Management(&$pm)
{
$this->Asset_Management($pm);
$this->vars = Array(
'pressdate' => Array(
'added' => '0.0.1',
'type' => 'text',
'default' => '',
'description' => 'Pressdate of the pressmeddelande',
),
);
}//end constructor
}//end classThis is the asset file:
class Pressmeddelande extends Page_Standard
{
/**
* Constructor
*
* @param int $assetid the asset id to be loaded
*
*/
function Pressmeddelande($assetid=0)
{
$this->Page_Standard($assetid);
}//end constructor
/**
* Called by the design to print the body of this asset
*
* @return void
* @access public
*/
function printBody()
{
$cm = &$GLOBALS['SQ_SYSTEM']->am->getSystemAsset('cache_manager');
$cached_contents = $cm->loadFromCache($this, 'default');
// used cached version if it exists
if (!empty($cached_contents)) {
echo $cached_contents;
return;
}
ob_start();
// Pressmeddelande needs a pressdate to be available.
$bodycopy = &$this->getBodycopy();
if (!is_null($bodycopy)) {
$bodycopy->printBody();
}
//$cm->saveToCache($this, 'default', ob_get_contents());
$cm->saveToCache($this->id, $this->type(), 'default', ob_get_contents());
ob_end_flush();
}//end printBody()
}//end class</pre><br />
I guess it has something to do with the cache part in the asset file. Or can it have something to do with how the cache manager cache the assets?
Turn your debugging level up in the System Configuration screen (to at least show the line numbers and backtrace). That way, Matrix will tell you the exact offending line in your code. 
I turned the debuggin up and now it all worked well, i do not get any error on frontend. But the Object to string is still in the error log
[quote]I turned the debuggin up and now it all worked well, i do not get any error on frontend. But the Object to string is still in the error log
[right][post=“9078”]<{POST_SNAPBACK}>[/post][/right][/quote]
Check the error log: It should tell you the file/line number that error is occuring on. Use that to debug your custom code.
[quote]
…[/quote]
$cached_contents = $cm->loadFromCache($this, ‘default’);
…
}//end class
I think that should be:
$cached_contents = $cm->loadFromCache($this->id, $this->type(), 'default');
Thanks for that Sertan!
It seem to be what you thougt it would be.