Welcome Guest, Not a member yet? Register   Sign In
Problem with CSS, JS, and IMG directory paths
#7

[eluser]ryantxr[/eluser]
Quote:The way I get round the changing paths problem is to test for the environment in my index.php and wherever a different path is required then test for the defined variable.

Code:
//index.php
    $myhost = strtolower($_SERVER['SERVER_NAME']);
    define('LOCALHOST', ('localhost' === $myhost));

// controller
   if (LOCALHOST) {
       $data['main_data']  = base_url() .'application/views/_data/';
   }else{
        $data['main_data'] = 'http://mydomain.com/ci_jokes/application/views/_data/';
   }


 
I appreciate the response. However, in order for DreamWeaver to read the css file or other asset, it has to know the path without having to execute php code. I have experimented and had some success with relocating the assets once deployed. It has to be done with relative paths which has one problem. The browser does not understand that myserver/index.php/main and myserver/indev/php/main/index refer to the same thing. The relative paths of these are different so it looks for the assets in a different place when using relative paths.
That is one of the good things of using raw PHP. The paths do not change at run time.


Messages In This Thread
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-02-2007, 07:30 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-03-2007, 01:55 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-03-2007, 05:03 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-04-2007, 06:30 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-04-2007, 06:47 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-04-2007, 09:38 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-04-2007, 11:35 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-05-2007, 01:35 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-05-2007, 02:40 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-05-2007, 05:28 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-05-2007, 07:05 AM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-05-2007, 03:51 PM
Problem with CSS, JS, and IMG directory paths - by El Forum - 11-25-2007, 12:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB