Help - Search - Members - Calendar
Full Version: Making variable text an link
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
devinepaul
I use a program that imports information from a database then exports it to HTML/CSS. The import function uses placeholders or html-replacers which are variables.

One of the data fields exported is a URL. The URL is not coded as a link though and you have to copy and paste to the address bar in order to go to the specified address.

I am wondering if there is a way to make exported data, namely a URL address, into a link even though it is a variable.

I have searched to find a javascript or CSS function that would work. I think if I could "name" this entry (such as link= or var= ) as an element or something then later in the code use the "name" to call on it and specify it as a link that would work.

Very rudimentary example:
var x=_MOVIE_WEBLINK_
Link = var x

I kinda doubt that helped any but it was probably good for a laugh.

So yeah I just need a code that will take the imported text which is already "www.imdb.com/XXXXXX" and then make it a link.

Here is the code that exports the movie title to HTML:

<div id="mTitle" name="mTitle" class=C2>_MOVIE_TITLE_</div>

Now if I simply change the above code to:

<div id="mTitle" name="mTitle" class=C2>_MOVIE_WEBLINK_</div>

The data field will be changed to the web link although it is simply in text form and not specified as a link.

This may help explain the coding which is a combination of (x)html-db and html: http://xmm.a.wiki-site.com/index.php/MovieCards

The id= and name= are not available for the web link export, im guessing they would have been mweblink, so it isn't possible to change those. Just the same changing "_MOVIE_TITLE_" to "_MOVIE_WEBLINK_" gives me the link as text. I just gotta be able to retroactively make that text, which is already a URL, into a link.

I am an extreme novice with html/css and whatever else coding you might see in there. Please let me know if any additional information will help.

Attached is the html file. The file has no data unless you import it from the program so all the data is in the form of html-replacers ie. _MOVIE_TITLE_ .

And thanks in advance for your assistance.
Christian J
Why can't you make the DB (or the server side script that connects to it) output

CODE
<a href="_MOVIE_WEBLINK_">_MOVIE_TITLE_</a>


?

BTW the attached HTML file is pretty unreadable without any code formatting. sad.gif

devinepaul
QUOTE(Christian J @ Aug 12 2008, 05:41 PM) *

Why can't you make the DB (or the server side script that connects to it) output

CODE
<a href="_MOVIE_WEBLINK_">_MOVIE_TITLE_</a>


?

BTW the attached HTML file is pretty unreadable without any code formatting. sad.gif


Yeah, I realized that the file was in fact not exporting the web link. It was working locally but not when exported. So you are right I have to get the server side to export the web link. I believe I will have to create an id and name function or find a way to simply export the URL as a link. The mdirector msubt mmedia mlanguage functions are essential for the export. I gotta create a mweblink.

Thanks for your help feel free to delete this post as I don't think that the post is really relevant to the forum category. Although a script to retroactively make a URL into a working link would be useful to someone perhaps.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.