assign an url to a tag

N

nice.guy.nige

While the city slept, Jan Faerber ([email protected]) feverishly typed...
Can you assign an url to a tag?
E.g. you have a table with some rows
and in each row a link.
And if you want to change the url
you only have to change the id.

I give here an url:
http://www.janfaerber.com/alt.html/assign-url2tag.php

It sounds like you are wanting to use CSS for this. CSS is for presentation,
not content.

As it appears you have php-enabled webspace, then why not try a php
approach? Something like the following;

<?php
$link1 = "http://www.microsoft.com";
$link2 = "http://www.google.com";
$link3 = "http://www.ebay.co.uk";
?>

<table>
<tr><td><a href="<?=$link1 ?>"><?=$link1 ?></a></td></tr>
<tr><td><a href="<?=$link2 ?>"><?=$link2 ?></a></td></tr>
<tr><td><a href="<?=$link3 ?>"><?=$link3 ?></a></td></tr>
</table>

.... Note: This is straight off the top of my head, and hasn't been tested.

You can also store the links in a separate php include file, then include it
into each file where you need it. Then you will only need to change links in
the include file.

Hope that helps.

Cheers,
Nige
 
K

Karl Core

nice.guy.nige said:
While the city slept, Jan Faerber ([email protected]) feverishly
typed...


It sounds like you are wanting to use CSS for this. CSS is for
presentation,
not content.

As it appears you have php-enabled webspace, then why not try a php
approach? Something like the following;

<?php
$link1 = "http://www.microsoft.com";
$link2 = "http://www.google.com";
$link3 = "http://www.ebay.co.uk";
?>

<table>
<tr><td><a href="<?=$link1 ?>"><?=$link1 ?></a></td></tr>
<tr><td><a href="<?=$link2 ?>"><?=$link2 ?></a></td></tr>
<tr><td><a href="<?=$link3 ?>"><?=$link3 ?></a></td></tr>
</table>

... Note: This is straight off the top of my head, and hasn't been tested.

You can also store the links in a separate php include file, then include
it
into each file where you need it. Then you will only need to change links
in
the include file.

Personally, I'd go with an array, then loop through the array to display it,
rather than hard code all this crap:
"<tr><td><a href="<?=$link3 ?>"><?=$link3 ?></a></td></tr>"


-Karl
 
M

Mitja

Can you assign an url to a tag?
And if you want to change the url
you only have to change the id.

Via an external file? Only with javascript :)
CSS is out, it does not and probably never will support this, because it has nothing to do with presentation.
What remains is a database (either a real one or a plain-text file) that is consulted by a server-side script each each time the page is requested in order to insert urls into tags with appropriate ids.
 
R

Robert Frost-Bridges

Mitja wrote:

[...]
CSS is out, it does not and probably never will support this, because
it has nothing to do with presentation.
[...]

I'm sure you meant to say it has everything to do with presentation. :)
 
N

Neal

Robert said:
I'm sure you meant to say it has everything to do with presentation. :)

What the OP wanted had nothing to do with presentation. Of course, CSS has
everything to to with presentation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top