udappkumara Posted September 14, 2011 Share Posted September 14, 2011 Hi I am a php learner and I am having some problems while loading images from templates. I will explain everything so hope you can understand my question.. My Folder Structure WEB SITE NAME - index.php [default landing page] + Images [images folder] + css [css folder] + templates [templates folder] |-- header.inc.php [header template] |-- footer.inc.php [footer template] + includes [folder for all classes and variables] + js [folder for all js files] + contact-us [this is a folder] |--index.php [this is the file inside the contact-us folder] + about-us [this is a folder] |-- index.php [this is the file inside the about-us folder] This is the header.inc.php file without some html markups <title>Web Site Name</title> <link href="css/reset.css" rel="stylesheet" type="text/css" /> <link href="css/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> </head> <body> <img src="images/phpmadeeasy.jpg" width="200" height="70" alt="php made easy logo" /> </body> ------------------------------------------------------------------------------ This is a sample main landing index.php page [i added codes only where i get into problems] <?php include_once('includes/header.inc.php') ?> <div id="mainWrapper"> <img src="images/phpbigbanner.jpg" width="200" height="70" alt="php big banner" /> </div> <?php include_once('includes/footer.inc.php') ?> ------------------------------------------------------------------------------ As you can guess, default index.php file works fine... load both logo and banner images but... this is the index.php file located under the about-us folder <?php include_once('includes/header.inc.php') ?> <div id="mainWrapper"> <img src="../images/phpbigbanner.jpg" width="200" height="70" alt="php big banner" /> </div> <?php include_once('includes/footer.inc.php') ?> ------------------------------------------------------------------------------ Here only the banner image load because the template file still show the logo image path as "images/phpmadeeasy.jpg" instead of "../images/phpmadeeasy.jpg" so is there any way me to define the default image folder as a variable so i can use that variable to load images from any directory level Example: <?php echo $images; ?>images/phpmadeeasy.jpg" <script type="text/javascript" src="<?php echo $js; ?>/jquery-1.4.4.min.js" <link href="<?php echo $css; ?>reset.css" rel="stylesheet" type="text/css" Thanks........... Quote Link to comment https://forums.phpfreaks.com/topic/247126-images-which-come-from-php-templates-are-broken/ Share on other sites More sharing options...
udappkumara Posted September 14, 2011 Author Share Posted September 14, 2011 Small question please... I am new to here, can someone tel me why there is a small strange robo head appear in my post in the forum... I thought i have done something wrong so i re posted this post again without links and all codes inside quotes but still i can see that strange robo head Quote Link to comment https://forums.phpfreaks.com/topic/247126-images-which-come-from-php-templates-are-broken/#findComment-1269207 Share on other sites More sharing options...
voip03 Posted September 14, 2011 Share Posted September 14, 2011 http://www.phpfreaks.com/forums/index.php?topic=343845.0 Please mark as Solved. Quote Link to comment https://forums.phpfreaks.com/topic/247126-images-which-come-from-php-templates-are-broken/#findComment-1269241 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.