I've also been trying to figure out a way of dynamically inserting links so that the links are separated from the content such that I can check for dead uns from a generated list, rather than clicking through the site to see if it works.
IceD wrote me a little function that pulls the links in from PHP variables, the only problem is that, of course, the text is in a MySQL table and, when I pull it into the HTML page, the PHP doesn't get parsed.
How to get around this. I feel I don't know enough yet. There must be some way of parsing content in a MySQL table as if it were PHP, so I could have the following in my table:
<div class="standard">
This is a text inside a MySQL table
and it contains <a href="<?php $title='title'; echo pull_link($title) ?>">a link called title</a>
</div>
The function would work something like this (there are almost certainly syntax and logic errors in this but you see my train of thought):
function pull_link($link) {
$dbcnx=mysql_connect("root", "user", "password");
//some error handling here
$db=mysql_select_db("my_db", $dbcnx);
//some error handling here
$link=mysql_query("SELECT link FROM hyperlinks WHERE title=$title);
//some error handling here
print($link);
return();
}
As you can see, I'm fumbling in the dark, but you can see what I want.
Any experienced people want to enlighten us?
Thanks
Norman