Welcome Guest, Not a member yet? Register   Sign In
Getting base url for CSS or image loading, modify index.php
#1

[eluser]renownedmedia[/eluser]
I modified my index.php and added this after the list of define()'s that CI uses:

Code:
define('SERVERPATH', str_replace("index.php", "", $_SERVER['PHP_SELF']));

Based on the installation directory, SERVERPATH will equal the following:

http://localhost/test/index.php -> /test/
http://www.example.com/index.php -> /

Which is useful for me and probably a lot of users who do development on a localhost subdirectory and later upload to a real server.

My question is if there is a better way to do this, like if CI has this functionality built in without modifying a core file?


Messages In This Thread
Getting base url for CSS or image loading, modify index.php - by El Forum - 06-01-2009, 09:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB