CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2004
    Posts
    438

    Relative Directories

    I'm having some trouble with relative directories, this time in html. I've downloaded a working webste via ftp and I'm just trying to run it, but it won't work offline. Here is the homepage:

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
    >
    <
    html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <
    title>Performance House</title>
    <
    link rel="stylesheet" href="/inc/style.css" />
    <
    style type="text/css">@import("styleMacIE.css");</style

    <
    meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <
    meta name="description" content="We work on your behalf to ensure you receive the level of service deserved as a customer." />
    <
    meta name="keywords" content="performance house, mystery, shopping, surveys, consumer, research, benchmarking" />

    </
    head><body>

    <
    div align="center">
      <
    div id="container">
      
        <
    div id="hdr">
          <
    div id="logo">
            <
    a href="/"><img src="/img/logo.gif" alt="" onfocus="this.blur();" /></a>
          </
    div>
           
          <
    div id="topNav">
            <
    a href="news.php"><img src="/img/news.gif" alt="News" onfocus="this.blur();" /></a>
            <
    a href="vision.php"><img src="/img/vision.gif" alt="Vision" onfocus="this.blur();" /></a>
            <
    a href="people.php"><img src="/img/people.gif" alt="People" onfocus="this.blur();" /></a>
            <
    a href="contact.php"><img src="/img/contactUs.gif" alt="Contact us" onfocus="this.blur();" /></a>
          </
    div>
          
          <
    div id="title">
            <
    img src="/img/hdr1.jpg" alt="" /><br />
            <
    img src="/img/haveYouResponded.gif" alt="Have you responded?" />
              <
    img src="/img/hdr2.jpg" alt="" /><br />
          </
    div>
        </
    div>
        
        <
    div id="rightNav">
          <
    img src="/img/ourWork.gif" id="rnTitle" alt="Our work" />
          <
    img src="/img/logos.gif" id="logos" alt="" usemap="#logos" />
          <
    img src="/img/reports.gif" id="rnTitle" alt="Reports" />

          <
    a href="http://www.DAinsider.com" target="_blank">The Directory Assistance B2B Publication</a><br />
          <
    a href="http://www.complaintscentre.com" target="_blank">National Complaints Centre</a><br />
          <
    a href="http://www.qualitymonitor.com" target="_blank">Qualitymonitor.com call centre development</a><br />
          <
    a href="http://www.118tracker.com/reports.shtml" target="_blank">118tracker.com Results</a><br />
          
          <
    div id="rightNavBottom">&nbsp;</div>
        </
    div>
          
          <
    MAP NAME="logos">        
            <
    AREA SHAPE="rect" ALT="University of Central Lancashire" COORDS="144,114,208,173" HREF="http://www.uclan.ac.uk" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="Amicus" COORDS="144,64,207,102" HREF="http://www.amicustheunion.org/" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="Zurich Financial Services" COORDS="144,13,205,54" HREF="http://www.zurich.com" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="Scottish Executive" COORDS="5,159,138,191" HREF="http://www.scotland.gov.uk/library5/finance/gpcc.pdf" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="Alcatel" COORDS="24,123,123,158" HREF="http://www.alcatel.co.uk" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="British Institute of Facilites Management" COORDS="24,95,124,122" HREF="http://www.bifm.org.uk" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="HBOSplc" COORDS="5,57,139,87" HREF="http://www.hbos.co.uk" onfocus="this.blur();" target="_blank">
            <
    AREA SHAPE="rect" ALT="118 Tracker" COORDS="19,4,125,51" HREF="http://www.118tracker.com" onfocus="this.blur();" target="_blank">
          </
    MAP>
            
          <
    div id="content">
            <
    h1>Performance House are working with you to improve quality and performance.</h1>
              <
    p>
            <
    img src="/img/eye.jpg" width="142" height="87" alt="" align="right" style="margin: 3px 0 0 8px;" />
              
    We work on your behalf to ensure you receive the level of service expected and deserved as a paying or enquiring customer.</p>
            <
    p>Our team of analysts are currently tracking the salesmarketinghelpdesksemployee &ampcustomer satisfactioncomplaint handlingcustomer services and procedures of world leading organisations.</p>
            <
    p>Working intently with customersconsumers and the world's media, our established links with government and regulatory bodies stimulate immediate improvements.
            <p>With a unique commitment to improving quality and performance, Performance House inspires effective strategies to measure, manage and improve entire market sectors.</p>
            </div>
            <br />
      </div><!--end of container-->

      <img src="/img/ftr.gif" id="ftr" alt="" />
    </div>

    </body></html> 
    As you can see the images are done using:

    PHP Code:
    <img src="/img/ftr.gif" id="ftr" alt="" /> 
    and not using the complete path name. I would have thought this fine, but when I run the web page it can't find the css or any of the images, why is this? Thinking about it it can't be the php include path because this is run as html and I get the same problems.

    This really anoys me when seemingly trivial things won't work.

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Relative Directories

    Two questions come to my mind.

    1. Have you tried right-clicking on the image and checking the properties as to know where the web-server/browser thinks that the image should be. It will display the full path.

    2. Is the following actually there for the running of IE on Mac? If so, you can most likely get rid of it. Microsoft dropped all development of IE for Mac at the end of 2005. Before that, there was no real big major update. Mostly Mac users work with Safari or Firefox.
    Code:
    <style type="text/css">@import("styleMacIE.css");</style>
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Dec 2006
    Location
    Atlanta, GA
    Posts
    41

    Re: Relative Directories

    Try taking the first forward slash off:

    Change:
    HTML Code:
    <img src="/img/ftr.gif" id="ftr" alt="" />
    to:
    HTML Code:
    <img src="img/ftr.gif" id="ftr" alt="" />

    Let me know if that works,
    Dave

  4. #4
    Join Date
    Dec 2004
    Posts
    438

    Re: Relative Directories

    PJ: I've tried checking the dir, and it should definitely be able to find the images, they're only in a sub-directory. I took out the mac css but it didn't affect things.

    Strangely though the img link seems to think that it is: http://localhost/img/haveYouResponded.gif . Why should it be doing this? Shouldn't it be saying:

    http://localhost/performance-house/p...uResponded.gif

    Already tried that Zetas and it didn't fix the problem.
    Last edited by Nibinaear; January 9th, 2007 at 04:48 AM.

  5. #5
    Join Date
    May 2002
    Posts
    10,943

    Re: Relative Directories

    Why don't you post a zip file with a folder of a couple of the images and a file with some of the folders from the directory tree. That would help us to see the directory layout.

    Quote Originally Posted by Nibinaear
    I took out the mac css but it didn't affect things.
    That shouldn't have fixed anything. I was just informing you that IE on Mac is, for the most part, obsolete.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  6. #6
    Join Date
    Dec 2004
    Posts
    438

    Re: Relative Directories

    I'll tell you where the dirs are:

    PHP Code:
    localhost c:/webpages
    Document root for performance-house website=
    PHP Code:
    c:/webpages/performance-house/public_html
    Images dir=
    PHP Code:
    c:/webpages/performance-house/public_html/img
    CSS dir (already mentioned)=
    PHP Code:
    ....public/html/inc/style.css 
    Ended up doing an attachment anyway. The only differences between this and the original website are that this is html which the original is php (don't know why this should affect anything).
    Attached Files Attached Files

  7. #7
    Join Date
    Aug 2002
    Location
    Brazil
    Posts
    730

    Talking Re: Relative Directories

    I've downloaded it.

    I've noticed by clicking right mouse button over images that they where refereing to images in c:/img even if the html file is in any other dir. Then i remembered from unix that / means root. So images are being searched on the /img... that means: a directory called img in the root dir (C.

    Then i replaced all "/img" in the HTML to "img" and images where shown properly. Try doin't that.

    BUT, that doesn't mean your problem is solved because PHP might be rendering a page (for example) in: www.website.com/html/page/birds/index.html
    when what the user typed in the browser something like www.website.com/pages.php?cat=birds

    That is done with includes.

    In that case browser will search images in: www.website.com/img/bird.gif
    when the real image exists in:
    www.website.com/html/page/birds/img/bird.gif
    All consequences are eternal in some way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured