Static files controller |
[eluser]antonagestam[/eluser]
Hi there! I'm quite new around here so please tell me if I do something wrong! I've put together a controller that handles static files, like CSS, images and javascript files. There might already be some solution for this but the little resarch I did didn't find any. Please tell me if you find this useful! You will need to redirect all requests to the 'static' folder to this controller. You also have to define the following variables in the config file: Code: // the folder where you keep your static files, defaults to 'static' Here is the controller: Code: <?php
[eluser]the_yk[/eluser]
hi antonagestam, I can't see why would we need a controller that handle a static file while we can use a direct url to that file.
[eluser]Marfo[/eluser]
If it's just for css/js, take a look at my loader extension ;-)
[eluser]antonagestam[/eluser]
[quote author="the_yk" date="1260249499"]hi antonagestam, I can't see why would we need a controller that handle a static file while we can use a direct url to that file.[/quote] Well, if you don't the client will not be able to cache those files and you can't transfer them gzipped. That is kind of the thaught behind this, though you'll have to add an expires header yourself.
[eluser]antonagestam[/eluser]
[quote author="Marfo" date="1260285944"]If it's just for css/js, take a look at my loader extension ;-)[/quote] Well it's not just for css/js it's for any static files that you would want to add an expires header to or transfer gzipped. |
Welcome Guest, Not a member yet? Register Sign In |