Hi All
I'm working on a website right now and the DNS is not yet swtiched over. That means I can only access the site by ip address. Like so: http://127.0.0.1/
However an added twist is that while accessing the site by IP address the path to root is different. Normall the url would be: http://www.mywebsite.com/index.php however because I am accessing the site by ip address it is different: http://127.0.0.1/USER/index.php
Okay now the problem. I have some code that creates a link. The code currently expects that the root directory is /index.php not /user/index.php. Is there a system variable that will tell me the path dynamically so that I can code around this problem?
Here is the code:
while ($lnMenu = mysql_fetch_array($result))
{
echo "\t\t\t\t <a href= $lnMenu[page_path]?page_id=$lnMenu[page_id] style=color:$LN_FONT_COLOR;font-family:$LN_FONT_FAMILY> $lnMenu[name]</a><br>\n";
}
So the variable $lnMenu[page_path] contains a value from the databse something like "/index.php" I need to add on to the beginning the whole server path: http://123.345.234.123/USER/
So when the users are building the site the links are http://127.0.0.1/USER/index.php and then once the DNS is changed the paths are dynamically changed to http://www.mywebsite.com/index.php
Any ideas?
Thanks in advance
Russ