Re: function that will print the url for embedded links
| From: | Fredrik Arild Takle | Date: | Wed, 01 Aug 2001 17:07:58 +0000 |
| Subject: | Re: function that will print the url for embedded links | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60710@lists.php.net to get a copy of this message | ||
You might wanna make a function for links:
<?php
function makelink($descr, $href) {
global $printer;
if ($printer) {
$link = "$descr ($href)";
} else {
$link = "<a href=\"$href\">$descr</a>";
}
return $link;
}
To echo an link in a site, do:
html above
<?php
echo makelink("Offical PHP-site", "http://www.php.net");
?>
html under
contact.php will echo:
<a href="http://www.php.net">Offical
PHP-site</a>
contact.php?printer=true will echo:
Offical PHP-site (http://www.php.net)
Hope this works!
Best Regards
Fredrik A. Takle
ElanIT
<sgibbs@vt.globalhealth.org> wrote in message
news:BB6D932A42D6D211B4AC0090274EBB1D2EF03B@GLOBAL1...
> I'm looking for a way to have a url for a link "explode" into the actual
url
> address. So for example, on a dynamically created webpage, I have a link
> called: Contact.
>
> When someone chooses to view the "printer friendly" version of this page,
I
> want the link on the the printer-friendly page to change to the following:
> "Contact (http://www.web.com/contact.html)".
>
> Any ideas of how to automate this process?
>
> Thank you, Shawna
>
>