Jump to content

"require" does not display imbedded image


newnewbie

Recommended Posts

I am using the require function to call a header.php file into another php file.  The header.php file runs with no errors, and displays the image.  But when the stories.php file requires header.php, the alt text for image appears, but not the image itself. 

 

Code for header.php:

 

<?php

 

print

<<<HTMLBLOCK

<html>

<head>

<link rel="stylesheet" type="text/css" href="../../_lib/_classes/class_main.css">

</head>

<body>

 

<!---places header graphic at top of page--->

<div class="header" ><img src="../_img/header_imgs/header.gif" alt="Different Starz" name="imgHeader" width="800" height="178" id="imgHeader" /></div>

 

</body>

</html>

HTMLBLOCK;

 

?>

 

 

Code for stories.php:

<?php

require ("../../core/header.php");

?>

 

Can someone explain what i have done wrong? Thanks!

Link to comment
https://forums.phpfreaks.com/topic/195375-require-does-not-display-imbedded-image/
Share on other sites

Start using Absolute Paths, as relative paths often cause problems, as you have just found out.

 

(IE remove the ../ and make it the actual url to access the image.)

 

As my bet is stories.php is not in the same directory level (meaning two directories up) of where that header file is normally included from.

 

More information on absolute vs relative: http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.