Jump to content

Images which come from php templates are broken.


udappkumara

Recommended Posts

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

 

 

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 :( 

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.