Relative link--why working only in IE?

Hi - can anyone see why an image is displaying only in IE6,7,8 but not in any other browser?

Altho’ I’m using wordpress, the problem is in the php that points to the relative location of the image. Before wordpress, to use relative links, I had a blank root.php file in root folder, then I had this in html above doctype:
if (file_exists(“./root.php”)) {
$rpath = “.”;}
else {
$rpath = “…”; }

Then a relative link looked like this in html mode - by “html mode” I mean when you have img src= or a href= :

<img src=“<?php echo $rpath ?>/gr-pg/top.gif” alt=

And a relative link looked like this in php mode:
<?php include(“$rpath/1cde/header.php”); ?>

To point to root in Wordpress, when in html mode you use:
“<?php bloginfo(‘template_directory’); ?>”

<img src=“<?php bloginfo(‘template_directory’); ?>/gr-pg/top.gif”

When in php mode, you use “TEMPLATEPATH .”:

<?php include(TEMPLATEPATH . ‘/1cde/header.php’); ?>

Now in wordpress, in my footernav.php, I call up a testimonial at random from testim.php like this - it works perfectly x-browser with TEMPLATEPATH .:

<?php include(TEMPLATEPATH . ‘/1cde/testim.php’); ?>
<?php echo $select; ?>

$spr3 = array(‘spr301’, ‘spr302’, ‘spr303’, ‘spr304’);
$i = rand(0, count($spr3)-1);
$select = file_get_contents(TEMPLATEPATH . ‘/1txt/’.$spr3[$i].‘.txt’);

BUT my problem is in my header.php I’m trying to call up a random recipe
photo, but I can’t get the final line in recip.php to work with
wordpress’s TEMPLATEPATH.

<?php include(TEMPLATEPATH . ‘/1cde/recip.php’); ?>
<img src=“<?php echo $select; ?>” alt=“raw recipes” width=“100px”
height=“100px” />

$photos = array(‘rec01’, ‘rec02’, ‘rec03’, ‘rec04’, ‘rec05’, ‘rec06’, ‘rec07’, ‘rec08’, ‘rectama’);
$i = rand(0, count($photos)-1);
$select = TEMPLATEPATH . ‘/gr-pg/’.$photos[$i].‘.jpg’;
//below is what it was before wordpress, worked perfectly xbrowser:
//$select = $rpath.‘/gr-pg/’.$photos[$i].‘.jpg’; -

IE is the only browser displaying the recipe photo. All the others can’t read it. I can’t understand why all browsers are reading the testimonial in:
$select = file_get_contents(TEMPLATEPATH . ‘/1txt/’.$spr3[$i].‘.txt’);

but none except IE can read the recipe in:
$select = TEMPLATEPATH . ‘/gr-pg/’.$photos[$i].‘.jpg’;

Can you perhaps see how to do it? It’s just this one line:

$select = $rpath.‘/gr-pg/’.$photos[$i].‘.jpg’;

where I need to replace “$rpath.” with wordpress’s way of doing it, using “TEMPLATEPATH .”

OR will wordpress’s:
<?php bloginfo(‘template_directory’); ?>

fit into that line somehow?

thanks million! - Val

The only thing you need to understand, but need it desperately:
Browsers don’t read files with file_get_contents. Browsers read HTML code.
It’s a greatest mystery in the web development, and must be understood by anyone dares to write their own code.

So. Once your browser refuse to show some image, you must take a peek into page’s HTML source and watch image path if it all right or not.

Once you discover it is not o.k., another mystery is awaiting you. There are files on the hard disk and there are resources in the HTTP URIs
Your browser does not have access to the server’s hard disk. But only to HTTP resources. Resource path starts from the web-server’s root, which is not similar to the hard disk’s filesystem root

Hi - I’m not sure, did you misunderstand my question? I know too little to know whether you misunderstood or not!

This used to work fine in testim.php, both on my hard drive and on my website:

$select = file_get_contents($rpath.‘/1txt/’.$spr3[$i].‘.txt’);

It randomly displayed the contents of spr301.txt, spr302.txt, spr303.txt, etc. The text is a testimonial.

All I need now is a way to tell wordpress the path - that is, a way to replace $rpath in that $select line, with one of wordpress’s path-pointers which are

bloginfo(‘template_directory’) (used with src= and href=) OR
TEMPLATEPATH . (used with include)

I’m here and not in a wordpress forum because I believe only a php expert can see how to enter bloginfo() or TEMPLATEPATH into the $select line.

So my questiuon is, please can you see how to replace $rpath with a wordpress path pointer?

thank you! - Val

what Shrapnel_N5 is getting at is, first, to start getting a grip on this problem, is to forget whether one browser manages to display something while another doesn’t etc.

the issue, to get at the heart of the problem, isn’t does browser a or b or c manage to display something, it’s: is the html, the part you’re interested in, correct? you need to act upon “Once your browser refuse to show some image, you must take a peek into page’s HTML source and watch image path if it all right or not.” and carry that out. it doesn’t matter which browser you do this in but do do this: visit the page, choose ‘view html’, or ‘view source’ or silmilar from your browser’s menu bars and view the raw html yourself, the part you’re interested in, to examine it. don’t rely-on/use browser displaying something or not displaying something to fix the kind of problem you’re trying to fix, rely-on/use the raw actual html code which your server outputs.

i know that’s not a direct answer to your question but it puts you in the position to be able to properly see what’s going on a bit better.

I understood your question very well.
But there are two kind of paths on your server.
You have to learn to distinguish one from another and understand it’s purpose.