I often use a function to create a list of links that are included in
several sites and disable the link that refers to the site itself
<?php
function maakZoNodigLink($omschrijving, $verwijzing)
{
$locatie = $_SERVER['PHP_SELF'];
if (strstr($locatie, $verwijzing)) //actual page
should not be linked
echo $omschrijving."<br>\n";
else echo ("<a href = \"$verwijzing\">$omschrijving</a><br>\n"); //other
pages are linked }
?>
Somewhere else in the page I do something like:
<?php
maakZoNodigLink("Hoofdpagina","main.php");
maakZoNodigLink("Geschiedenis", "gesch.php");
?>
Although it works okay, I have to do some editing when I use the function
for another site. E.g. in this example every link is followed by a <br> and
when want to create a menu bar like [home][hobby's][contact] and the actual
link should not be underlined, I have to realise a lot of changes *within*
the function itself.
I have been thinking about possibilities to create an additional variable
like $separator = "<br>" but I don't know where to locate it. Besides I
wonder if there is a more efficient way then callling the maakZoNodigLink
function several times, as I do in the example above.
Would like some feedback because I have the feeling that I am doing things
in a more complicated way then I should do :-)
Thanks for any help,
Martien van Wanrooij