Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to smokey01,bungeejumper,stockton,Anonymous,bruncher, for Donating to support the site

Really basic HTML question

Seek assistance with all types of tech. - computer, phone, TV, heating controls etc.
NomoneyNohoney
Lemon Slice
Posts: 994
Joined: November 4th, 2016, 10:31 am
Has thanked: 344 times
Been thanked: 460 times

Really basic HTML question

#670460

Postby NomoneyNohoney » June 23rd, 2024, 11:31 am

I don't really know why I've done this, but let me explain.
The UK telephone directory is being discontinued, so I downloaded all the PDFs. These are titled, Ashford.pdf, Barnstaple.pdf, Croydon.pdf etc.
I've saved them in one directory, and want a simple html index for them. If the folder is on a D: USB drive, or an F: USB drive, I think the hyperlinks have to take you back to the root of whatever the drive is, and then point up from there. That way, it should always work whatever drive it's on.

I've gone foggy: Can someone give me the line of hyperlink that I need?

I guess it's cd.. to start with, and then a link to the file, but my brain has clouded over.

TIA

Edit:- I guess it might be :
cd../cd pdfs/ashford.pdf, or Barnstaple.pdf
That sound right?

Urbandreamer
Lemon Quarter
Posts: 3326
Joined: December 7th, 2016, 9:09 pm
Has thanked: 381 times
Been thanked: 1101 times

Re: Really basic HTML question

#670469

Postby Urbandreamer » June 23rd, 2024, 12:09 pm

NomoneyNohoney wrote:I don't really know why I've done this, but let me explain.
The UK telephone directory is being discontinued, so I downloaded all the PDFs. These are titled, Ashford.pdf, Barnstaple.pdf, Croydon.pdf etc.
I've saved them in one directory, and want a simple html index for them. If the folder is on a D: USB drive, or an F: USB drive, I think the hyperlinks have to take you back to the root of whatever the drive is, and then point up from there. That way, it should always work whatever drive it's on.

I've gone foggy: Can someone give me the line of hyperlink that I need?

I guess it's cd.. to start with, and then a link to the file, but my brain has clouded over.

TIA

Edit:- I guess it might be :
cd../cd pdfs/ashford.pdf, or Barnstaple.pdf
That sound right?


Not sure if you need to change directory. That would depend if the pdf had links to other files.
The html link form is

Code: Select all

 <a href="file://path_to_file">Some text decribing the file</a>
 


I'd recommend finding some tools to write most of the code for you.
For example ls, dir or find can list the files, one to a line.
Awk can read those filename lines and create a file with lines containing the bulk of the html.
You could then cut and paste into your favorite editor.

mc2fool
Lemon Half
Posts: 8155
Joined: November 4th, 2016, 11:24 am
Has thanked: 7 times
Been thanked: 3157 times

Re: Really basic HTML question

#670477

Postby mc2fool » June 23rd, 2024, 12:25 pm

The HTML for a hyperlink is the <a> tag. See https://www.w3schools.com/tags/tag_a.asp

So, if your index is in the top level of the USB drive (be it D: or F: or wherever) then the HTML you need is one with a relative URL, e.g.:

<a href="pdfs/Barnstaple.pdf">Barnstaple</a>

The browser will automatically bung onto the front of that the location of the index file, so if it's in D: the link will actually be "file:///D:/pdfs/Barnstaple.pdf".

If, OTOH, you've put the index into a folder off of the top level (why?) e.g. x:/index then use <a href="../pdfs/Barnstaple.pdf">Barnstaple</a>


Return to “Technology - Computers, TV, Phones etc.”

Who is online

Users browsing this forum: No registered users and 33 guests