Welcome Guest, Not a member yet? Register   Sign In
Dynamic javascript and CSS files - through code igniter
#3

[eluser]bwuk[/eluser]
Hi,

so I've been doing more digging on this issue.

If I change my .htaccess FilesMatch directive to:

Code:
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|php)$"> # (note the php at the end)
    Header set Cache-Control "max-age=290304000, public"
    Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
</FilesMatch>


then my javascript files are then cached....however, this leads to all of my other php files being cached....not what I want Smile

Ideally, I'd prefer to do this in CI. I've extended Controller, and added my own called Public_Controller. In there, I do some detection to determine whether or not I'm able to cache certain content. If I'm using my javascript class or my css class, then I can cache the content:

Code:
if ($this->cacheable_content())
{
    $this->output->cache(1440);
}

I've also tried:

Code:
if ($this->cacheable_content())
{
    $this->output->set_header("Cache-Control: max-age=290304000, public");
    $this->output->set_header("Expires: Thu, 15 Apr 2010 20:00:00 GMT");
}

but again, that just doesn't seem to work. I'm running out of ideas here Sad


Thanks

bwuk


Messages In This Thread
Dynamic javascript and CSS files - through code igniter - by El Forum - 01-28-2009, 06:51 AM
Dynamic javascript and CSS files - through code igniter - by El Forum - 01-28-2009, 12:31 PM
Dynamic javascript and CSS files - through code igniter - by El Forum - 01-30-2009, 05:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB