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.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jun 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Automatic link generator based on filelist

    I am a relative newbie at this, but here goes...

    I am developing an off-line html based O&M manual. It is 90% complete based on all the help I got from reading here (Thanks Everyone!!!!) I registered today because I have a need that I have not found an easy answer to and finally had to post.

    My project contains a folders loaded with .pdf, and .dwg files. Is there an easy way to generate links to the individual files without manually generating an href? My goal here is to be able to generate all the href's for the folder, and as the folder changes, I can develop the new links rather effortlessly. What would be the best action to undertake?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try puttin all the names in an array and having a for loop go throught the array generating links like his for example

    mylinks = new Array(5) // cahnge 5 to howmany numbers you may have

    mylinks[0] = "page1.pdf"
    mylinks[1] = "page2.pdf"
    mylinks[2] = "page2b.pdf"
    mylinks[3] = "index.pdf"
    mylinks[4] = "about.pdf"

    for (i = 0; i <= mylinks.length; i++)
    {
    document.write("<a href='"+mylinks[i]+"'>"+mylinks[i]+"</a>")
    }
    photoshop too expensive? use the GIMP! www.gimp.org

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You can do it with a server-side language. I have a PHP sniplet that read all the files in the current directory and made a list of them all and made them hyperlinks to the files. However I can't seem to find it. I'll have to look on my hard drive for it.

    In the mean time, try hotscripts.com

    Oh, wait hmmm you are making this off-line? Like for someone to download and read? Then it makes it difficult; my idea would work if they were reading it off your site. You'll have to do something like what whackaxe suggested.
    OracleGuy

  • #4
    New Coder
    Join Date
    Feb 2009
    Location
    Alexandria, VA
    Posts
    21
    Thanks
    9
    Thanked 0 Times in 0 Posts
    I would like to have an automatic link generator enabled for certain pages of my website. The goal is to have certain keywords picked up by the script and replaced with a link to the designated page for the keyword. Is this possible?

  • #5
    New Coder
    Join Date
    Oct 2008
    Location
    Australia
    Posts
    32
    Thanks
    1
    Thanked 1 Time in 1 Post
    regular expressions.

    element.replace(/keyword/gi,'<a href="link" >LINK NAME</a>');

  • Users who have thanked stick_branch for this post:

    colby2152 (08-17-2009)


  •  

    Posting Permissions

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