Skip to main content
campinginoregon
Participant
November 3, 2011
Answered

I can not see my pictures when I use Server Side Includes

  • November 3, 2011
  • 1 reply
  • 940 views

I am trying to use SSI in my header and it will not show the image if the page is to deep in my files:

Does not work:

http://www.campingcoaches.com/states/oregon/oregon.php The code is <?php include("../../includes/header2.php"); ?>

but is I move it up on level:

http://www.campingcoaches.com/states/colorado.php the Code is <?php include("../includes/header2.php"); ?>

Then it seems to work fine

I have also tried to make the header relative to the site root at that point I got a error message.

http://www.campingcoaches.com/states/oregon/oregon.php you can see the code error

The menus both use the same Code and they work?

<?php include("../../includes/menu2.php"); ?>

I am playing around and learning this so my knowledge base is relitively thin but I enjoy computers and the outdoors. Bottom line be gentle and assume you are I know very little at age 50 and just getting started.

This was already posted in Adobe Forums > Dreamweaver > Dreamweaver Development Toolbox > PHP Application Development > Discussions  without a response so I thought i might be in the wrong area.

Thank you for any help that might be offered,

Gene

All it takes for Evil to thrive is for good people to do NOTHING

This topic has been closed for replies.
Correct answer MurraySummers

As I suspected.  All links in include files must be root relative links, not document relative ones.

This link does not work -

<img src="../images/family 2.jpg"  (document relative)

while this link does work -

<a class="MenuBarItemSubmenu" href="/index.php"> (root relative)

Make all links in your include files be root relative, and you'll never have a problem.

1 reply

MurraySummers
Inspiring
November 3, 2011

http://www.campingcoaches.com/states/oregon/oregon.php The code is <?php include("../../includes/header2.php"); ?>

Show us the code in header2.php, please.

campinginoregon
Participant
November 4, 2011

The header that does not work

<div align="right"><img src="../images/family 2.jpg" width="320" height="226" /><img src="../images/hiking mountain ridge 2.jpg" width="760" height="226" /></div>

The menus are that works is:

<ul id="MenuBar1" class="MenuBarHorizontal">
    <li><a class="MenuBarItemSubmenu" href="/index.php">Home</a></li>
    <li><a href="#">RV Camping</a></li>
    <li><a href="#">Tent Camping</a></li>
     <li><a href="/Googlemaptest_3.php">Back Packing</a>
       <ul>
         <li><a href="#">Trails</a></li>
         <li><a href="/Googlemaptest_4.php" class="MenuBarItemSubmenu">Local Hikes</a>
           <ul>
             <li><a href="#">Pacific Crest Trail</a></li>
           </ul>
         </li>
       </ul>
     </li>
    <li><a href="#">With the Kids</a></li>
    <li><a href="#">Camping Tips</a></li>
    <li><a href="#">Ask a Friend</a></li>
    <li><a href="/web_pages/about_us.php">About us</a></li>
</ul>

<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
</script>

if you need anything else just let me know.

Gene

MurraySummers
MurraySummersCorrect answer
Inspiring
November 4, 2011

As I suspected.  All links in include files must be root relative links, not document relative ones.

This link does not work -

<img src="../images/family 2.jpg"  (document relative)

while this link does work -

<a class="MenuBarItemSubmenu" href="/index.php"> (root relative)

Make all links in your include files be root relative, and you'll never have a problem.