Welcome Guest, Not a member yet? Register   Sign In
hiding CI paths for CSS Images etc....
#1

[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
#2

[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.
#3

[eluser]thurting[/eluser]
//
#4

[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 >.<!
#5

[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...
#6

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

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




Theme © iAndrew 2016 - Forum software by © MyBB