Welcome to WebmasterWorld Guest from 54.147.44.13

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Image include script

Hung up on home page syntax

     
3:48 pm on Jul 6, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Sept 22, 2003
posts:225
votes: 2


I am using a simple script to call images based on location...

<?if(strpos($_SERVER['PHP_SELF'],"/accommodations/")!==false){?>

but having a hard time when it comes to the index/root/home page as it confuses with all other directories index page.

<?if(strpos($_SERVER['PHP_SELF'],"/index.php")!==false){?>

Is there an easy solution for the home page?

TIA KOB

3:56 pm on July 6, 2007 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member jab_creations is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 26, 2004
posts:3145
votes: 12


I'm not exactly sure if this is helpful but a friend showed me a better way to access relative paths in PHP. This is how I use it for relative includes...

include realpath(dirname(__FILE__) . "/../../index.php");

- John