This thread has been discontinued although it still contains a lot of valuable information. For the latest discussions on Miser, please post your questions in the thread:
"Miser - Website OptiMISER".
http://www.concrete5.org/community/forums/customizing_c5/miser-web-...
Concrete is a fantastic product. However. I nearly went elsewhere after a couple of days due to its reluctance to load pages. I commented on another thread how I had managed to get it to go faster. I had no reponse from anyone so I thought I'd share the actual code in the hope that it helps others as it did me. There is no warranty with this, so use at your own risk. It may also not be suitable for all sites that are heavily dependent on Concrete5s cahcheing system. But it's here non-the-less.
Attached are 4 files."View.php" (which you should place in your top level libraries directory), "dashboard.php" (which goes in your top level themes/core/ directory) and "header_required.php" + "footer_required.php"(which both go in your top level /elements directory). You won't be over-writing the core files so if you find it doesn't work for you, then can just delete them to go back. The CC5 team have implemented an excellent customisation system where you can modify the core files without actually modifying them - hats off to the team.
What do they do?
They basically sort the HTML headers (css, javascript and links) and minify the contents.
How does it work?
Any item that is added to the header (addHeaderItem) is inspected and sorted into a number of categories. If it is in-line CSS it is all concatenated together and minified. This then goes to the top of the header.
If it is a relative style-sheet, it is checked to see how big it is (on disk) and, if it's small, its added to the inline styles above. If it's big its added to another category. These are then output after the in-line CSS.
Exactly the same process happens happens with Javascript. However, the Javascript is moved to the footer (except for JQuery). The jQuery is also obtained from the Google Content Delivery Network.
All the above is achieved in View.php on its own.However, to get some javascript to the bottom when in Admin mode, the other files are required which move around some hard-coded javascript to enable them to be sorted in the header. There are other hard-coded javascript dotted around the core, but for simplicity I've only supplied these.
---------------------------->>>
The final bit of the optimisation process (after putting the files in) requires adding some lines to the .htacess. If you don't know what that is. Then don't do the next bit.
This will sort out the expires times and enable gzip compression (if not already active) meaning much more of your static content will be cached in the users' browser and everything will be GZipped - making YSlow happier. The above changes mean that the site will "seem" to load much faster on the first visit. The next bit means that the second visit (and while they are going from page to page) will be relatively instant.
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
<IfModule mod_expires.c>
<IfModule mod_headers.c>
Header unset Pragma
<IfModule mod_deflate.c>
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>
<IfModule mod_expires.c>
<IfModule mod_headers.c>
Header unset Pragma
FileETag None
Header unset ETag
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|gif|jpg|jpeg|png|swf)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
# Set up 31 days caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A2678400
Header append Cache-Control "proxy-revalidate"
</FilesMatch>
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
</IfModule>
</IfModule>
If you like this article (and it works for you) then I will post the super steroid version (once I've finished it)
Quick question: do expires headers need to be enabled on the server (like Gzip) or can they be used no matter what?