Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    quick question (cant describe it 4 subject!)

    to load a picture from the directory below the page you use "../picture.jpg" but what do i put instead of "../" to make it load from the man (first) directory?

    thanks, paul

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    London
    Posts
    220
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you mean going back several folders?

    It really depends on where the image is.

    Say you have following structure:

    www.yourdomain.com
    which has the folders 'pages' and 'images'.

    'images' folder contains logo.jpg
    'pages' folder consists of index.htm and another folder called 'morepages' which contains the page 'news.htm'

    To insert the logo onto the news page, you would need to specify that you want to go two folders back, and then into the images folder as such
    img src="../../images/logo.jpg"

    So try working out from this example where you need to go in order to be able to see the correct folder and image.

    Mxx
    "Imagination is more important than knowledge" A. Einstein's 'Twin Paradox'

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i will try and explain myself more. its in a .js file which will be used for all pages (which are in different directories) and instead of putting the full address for everything in it, i thought there would be a shortcut way like "../"

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    London
    Posts
    220
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope still not really getting you - So, you have one .js file which has an image you need for lots of pages?

    Each page will have a link to the .js file so you can simply type the location of this file instead of using any ../ in it!

    so, instead of typing src ="../image.jpg" which will only work for files in that folder, why not type src="http://www.yourdomain/folder/image.jpg" so that every file you have will link direct to the image?

    ...if this is what you mean?

    Forgive my lack of understanding - my brain is fried from figuring out how to set up a forum.

    Mxx
    "Imagination is more important than knowledge" A. Einstein's 'Twin Paradox'

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thats ok, ive got a headache so my brains not functioning much better either!!

    i know you can type the whole address of the picture in, i just thought that if you can use ../ to go back one directory that there was something like ./ that would take you back to the top directory. if not, i will just use the full address. just wanted to know if there was a way.

    thanks anyway, paul

  • #6
    New Coder
    Join Date
    Aug 2002
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To get to the top directory (the folders within the top directory) use:

    <img src="/something.jpg">


  • #7
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i tried that galdo but it didnt work

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    London
    Posts
    220
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't know of a way that you can do that and just go for using the full address. Although using templates or CSS may make the job slightly quicker if you have lots of pages.

    Mxx
    "Imagination is more important than knowledge" A. Einstein's 'Twin Paradox'

  • #9
    New Coder
    Join Date
    Aug 2002
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by hypedup.co.uk
    i tried that galdo but it didnt work
    Yes it does work, give me an example of what you are trying to do.

  • #10
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    heres part of the code in the javascript i am using on all pages:

    document.write('<script language="javascript" src="/all/javascript.js"></script>');
    document.write('<link rel="stylesheet" href="/all/stylesheet.css" type="text/css">');

    ive put the / at the start like you suggest but it now means it doesnt work for any pages - no matter what directory they are in!

  • #11
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    Galdo is correct.

    are your .js and .css files located in the all folder under the root directory? could you illustrate your directory structure?

  • #12
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yes, the .js and .css files are in the all folder (www.website.com/all) and the html files are in the root directory or in other folders (eg www.website.com/games). i also have a menu which i have the same problem with (although i havent tried putting a / at the start for the menu links).

    the problem is if i put the whole address in, i cant look at my site from my computers hard drive as it will be looking online instead.

  • #13
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    im sorry, it did work - sorta! the reason why i thought it didnt was cos it was making pic locations etc go to "C:/picture.gif" on my local machine and not "C:/website/picturegif".

    is there anyway of getting it to work on both the live website AND my local machine?

  • #14
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You don't happen to have a <base ...> tag in those web pages do you?

  • #15
    New Coder
    Join Date
    Jun 2002
    Location
    uk
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    no, no <base> tags


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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