Forum Moderators: open

Message Too Old, No Replies

HTML link question

         

hermes

6:19 am on Jul 10, 2006 (gmt 0)

10+ Year Member



Here is an HTML link:

<a href="Apulia.php">Apulia</a><br>

I want to have the Apulia.php as the link name, as opposed to Apulia, and I DONT want to have to write Apulia.php twice like so:

<a href="Apulia.php">Apulia.php</a><br>

I just want Apulia.php mentioned once. Is there another link format that will allow this? Help!

------

PS The reason for this strange Q - I have a textfile with a long list of filenames (thousands)

Apulia.php
Austria.php.....etc.

And I want to use a simple find and replace to wrap html code around these to make them html links. Easy - if links didnt have the problematic structure I have outlined above.

[edited by: hermes at 6:37 am (utc) on July 10, 2006]

bedlam

6:34 am on Jul 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to have the Apulia.php as the link name, as opposed to Apulia, and I DONT want to have to write Apulia.php twice

This makes no sense.

There is only one way, in html, for the destination of a link (the value of the href attribute) and the link text to be the same, and that's for them each to contain the same value.

[edit]Ah, but it turns out you have a good reason for wanting what you do ;-)

If you have a good text editor (even Dreamweaver is capable of this) that lets you use regular expressions in the find-and-replace dialogue, you will be able to do this.

However, you'll need somebody more at home with regular expressions than I am to help out. Or you could start with a tutorial [google.ca].

-b
[/edit]

[edited by: bedlam at 6:43 am (utc) on July 10, 2006]

Robin_reala

6:41 am on Jul 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can use regular expressions to find/replace what you want. I only know Textpad's regular expressions which I'm sure aren't complaint with anything elses but fwiw given one filename per line you'd do this:

Find:

\(.*\)\n

Replace:

<a href="\1">\1</a>\n

to turn them all into links.

hermes

7:52 am on Jul 10, 2006 (gmt 0)

10+ Year Member



thanx guys. got it done in dreamweaver.

Programmers

2:38 pm on Jul 10, 2006 (gmt 0)

10+ Year Member



Notepad, and use the find and replace tool. It's a godsend. Without that, I would still be doing somethings now!

Say you have a file full of links like this

<a href="aye.php">aye</a><br>
<a href="bee.php">bee</a><br>
<a href="see.php">see</a><br>

Rather than going all the way down and doing them one by one, just find </a> and replace it with .php</a>