Hi @jemz,
I have struggled with paths and now define all paths in a constant.php. The file is then included:
# constants.php
PHP Code:
# constants
define('LOCALHOST', in_array($_SERVER['SERVER_NAME'], array('localhost', '127.0.0.1') ));
if(LOCALHOST)
{
$tmp = "c:\wamp\www\first_folder\second_folder\third_folder\";
define('THUMB_PATH', substr($tmp,2) );
define('THUMB_URL', "http://subdomain.localhost/thumb/");
}
else
{
define('THUMB_PATH', "/home/content/42/558877/html/ci_john/subdomain/thumb/');" );
define('THUMB_URL', "http://subdomain.Johns-Jokes.com/thumb/");
}
#usage: - works both for LOCALHOST and Online
PHP Code:
require_once 'constants';
echo "<img src='" .THUMB_URL ."image.jpg' style='border:0' alt='whatever' />";
Bookmarks