Welcome Guest, Not a member yet? Register   Sign In
HOWTO: rewrite requests for images, css and js to different folders for each application?
#6

[eluser]slowgary[/eluser]
I don't completely understand your rewrite as I'm not very good with them. Are your apps each on their own subdomain? Or a subfolder? Or do they each have a different domain and they're just sharing a server?

I pictured a controller like this:
Code:
<?php

class Assets extends Controller
{
    function Assets()
    {
        parent::Controller();
        $this->load->helper('file');
        $this->load->helper('download');
    }

    function _remap()
    {
        if(defined(APP_NAME))
        {
            $type = $this->uri->segment(2);
            $file = $this->uri->segment(3);

            if($data = read_file('/realpath/'.APP_NAME."/$type/$file"))
            {
                force_download($file, $data);
            }
        }
    }
}

/* End of controller */

Then you'd define APP_NAME in your apps as the folder where that app's assets are in. You would then access your assets at:
Code:
/assets/js/filename.js


Messages In This Thread
HOWTO: rewrite requests for images, css and js to different folders for each application? - by El Forum - 06-29-2009, 09:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB