Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-28-2002, 08:55 PM   PM User | #1
I_try
New to the CF scene

 
Join Date: Jun 2002
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
I_try is an unknown quantity at this point
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?
I_try is offline   Reply With Quote
Old 06-28-2002, 09:16 PM   PM User | #2
whackaxe
Senior Coder

 
Join Date: Jun 2002
Location: paris, france
Posts: 1,216
Thanks: 0
Thanked 0 Times in 0 Posts
whackaxe is an unknown quantity at this point
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
whackaxe is offline   Reply With Quote
Old 06-29-2002, 06:30 AM   PM User | #3
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,043
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
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
oracleguy is offline   Reply With Quote
Old 08-13-2009, 07:43 PM   PM User | #4
colby2152
New Coder

 
Join Date: Feb 2009
Location: Alexandria, VA
Posts: 21
Thanks: 9
Thanked 0 Times in 0 Posts
colby2152 is an unknown quantity at this point
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?
colby2152 is offline   Reply With Quote
Old 08-14-2009, 01:49 PM   PM User | #5
stick_branch
New Coder

 
Join Date: Oct 2008
Location: Australia
Posts: 32
Thanks: 1
Thanked 1 Time in 1 Post
stick_branch is an unknown quantity at this point
regular expressions.

element.replace(/keyword/gi,'<a href="link" >LINK NAME</a>');
stick_branch is offline   Reply With Quote
Users who have thanked stick_branch for this post:
colby2152 (08-17-2009)
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:56 AM.


Advertisement
Log in to turn off these ads.