CodeIgniter Forums
hiding CI paths for CSS Images etc.... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: hiding CI paths for CSS Images etc.... (/showthread.php?tid=2404)



hiding CI paths for CSS Images etc.... - El Forum - 08-03-2007

[eluser]Unknown[/eluser]
hello

I'have looked into CI www source kode and find this (for CSS src):

Code:
.... src="http://codeigniter.com/?css=global/sIFR-print.css" ...

how is this done???

hiding paths seems more elegant and secure

I would like to hide all css, js and images paths.

Please help


hiding CI paths for CSS Images etc.... - El Forum - 08-03-2007

[eluser]Derek Allard[/eluser]
We built the CodeIgniter site with ExpressionEngine, and this is a standard, "out of the box" feature. It would work differently in CI.


hiding CI paths for CSS Images etc.... - El Forum - 08-04-2007

[eluser]thurting[/eluser]
//


hiding CI paths for CSS Images etc.... - El Forum - 08-04-2007

[eluser]Phil Sturgeon[/eluser]
Just create a new controller called media.php with a method for css, javascript, images, etc.

Then you just need to use file() to read it and echo the output directly to the browser. Might look something like this:

Code:
<?php
class Media extends Controller {
    function css($file)
    {
        $this->load->helper('file');
        $this->output->set_header("content-type: text/css");
        $this->output->set_output(read_file('./media/css/'.$file));
    }

    function javascript($file)
    {
        $this->load->helper('file');
        $this->output->set_header("content-type: application/x-javascript");
        echo read_file('./media/js/'.$file);
    }

}
?>

Then just call

Quote:media/css/something.css

Images might be a bit trickier, and this wouldnt allow subdomains, but you get the idea. Then again... this might not actually achieve anything as it appears to be a fully working path and hotlinking may still work >.<!


hiding CI paths for CSS Images etc.... - El Forum - 04-14-2009

[eluser]gyo[/eluser]
Don't you think that using a controller (which seems the easiest solution for me too) will waste a lot of memory and cpu? Because it will reload ALL the framework for each css, with all the autoloads etc...

I was thinking of having another php file at the same level of index.php that doesn't rely on the framework.

Not sure tho...


hiding CI paths for CSS Images etc.... - El Forum - 04-14-2009

[eluser]TheFuzzy0ne[/eluser]
You're almost 2 years too late. Tongue


hiding CI paths for CSS Images etc.... - El Forum - 04-14-2009

[eluser]gyo[/eluser]
LOL! I didn't see the date! Big Grin