Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.