Results 1 to 7 of 7

Thread: Inserting .js include on every htm file in website

  1. #1
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Inserting .js include on every htm file in website

    Hi,
    Had a wondering (trying to save time actually). I am using Frontpage (ok, ok, I know what you're going to say, but I've used it so long I'm addicted - it's kind of like a cigarette addiction - no benefits but you just keep doing it...)

    OK, back on track. I want to add a .js include on every htm page in the file. Any ideas how to do this without using an absolute http://... location for the .js file? The problem is that if I do a "Find & Replace" to replce the </head> tag with the code + the </head> take, there is no consideration given to the folders location, recursiveness, etc.....

    Any thoughts?

    Tim

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What's wrong with using the absolute path?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    I don't like to use them either, but they do sometimes make it easier (absolute paths). You can use these:

    ../ = go back a directory, ../../../, etc.
    for staying in current, just type in the name.

    example:

    ------images------------------------------folder3(../../css/css.css)
    index.html(images/image.jpg)
    ------css------------------folder2(../images/image.jpg)

    I think that explains it. The farthest one is deepest in, I know its not efficient, but I think it should do.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Also, a single preceding slash means the root, so instead of:

    Code:
    src="http://www.somedomain.com/scripts/myscript.js"
    you can:

    Code:
    src="/scripts/myscript.js"
    It means the same thing.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks all for your input.

    The reason that I didn't want to hard code an absolute is that I wanted to keep it as portable as possible, if I use forwarding or want to copy a few pages into another website.

    Just an additional note to John's comment: According to another reply on a Frontpage forum, if you use the leading "/" this will start from te root, however if you are using a "Disc based" web, such as when previewing in FP or DW, it will fail as the "/" will direct back to the root of the disc, not the root of the webs directory.

    Again thanks to all for a helpful forum!!

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I am using Frontpage (ok, ok, I know what you're going to say, but I've used it so long I'm addicted - it's kind of like a cigarette addiction - no benefits but you just keep doing it...)
    Then quit :-\
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    More about /

    All path conventions have limitations. The relative path will often fail if the page is moved. The absolute path is no good locally for testing local resources, it will grab the resources from the web. If you use a unique drive for web testing, and put the root files in the root directory and build from there, / will work out quite well both local and remote.

    For my own work, I usually use relative paths though, and not FP, &@#!#.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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