newnewbie Posted March 15, 2010 Share Posted March 15, 2010 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! Quote Link to comment https://forums.phpfreaks.com/topic/195375-require-does-not-display-imbedded-image/ Share on other sites More sharing options...
premiso Posted March 15, 2010 Share Posted March 15, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/195375-require-does-not-display-imbedded-image/#findComment-1026694 Share on other sites More sharing options...
newnewbie Posted March 16, 2010 Author Share Posted March 16, 2010 Yeah!!! So simple. Thank you sooo much. Quote Link to comment https://forums.phpfreaks.com/topic/195375-require-does-not-display-imbedded-image/#findComment-1026715 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.