...

Automatic link generator based on filelist

I_try
06-28-2002, 08:55 PM
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?

whackaxe
06-28-2002, 09:16 PM
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>")
}

oracleguy
06-29-2002, 06:30 AM
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.

colby2152
08-13-2009, 07:43 PM
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?:D

stick_branch
08-14-2009, 01:49 PM
regular expressions.

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum