Web Analytics Made Easy -
StatCounter Automatic link generator based on filelist - CodingForum

Announcement

Collapse
No announcement yet.

Automatic link generator based on filelist

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    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

    Comment


    • #3
      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

      Comment


      • #4
        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?

        Comment


        • #5
          regular expressions.

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

          Comment

          Working...
          X