Evie
01-22-2007, 01:54 PM
I have a function that searches a txt file. I need the return to display as a link. What would be the proper syntax for that?
|
Click to See Complete Forum and Search --> : Return as a link Evie 01-22-2007, 01:54 PM I have a function that searches a txt file. I need the return to display as a link. What would be the proper syntax for that? NightShift58 01-22-2007, 02:01 PM Your function should return a string or false, if the search failed. If the return value is not false, then could can display the value as a link. What I am trying to say is that you shouldn't be tempted into coding:<?php echo MyFunction(); ?> Better would be:<?php $MyLink = MyFunction(); if ($MyLink) { echo "<a href='$MyLink'>.....</a>"; } ?> Evie 01-22-2007, 02:36 PM My apologies, I'm trying to help a friend. The function returns a hard drive address, I want to pull out the file name and put it on the end of a url. like is: <a href="URL_BASE/<?php {$result_from_explode} ?>">LINK</a> correct? NightShift58 01-22-2007, 02:44 PM <?php $FULLpath = MyFunction(); if ($FULLpath) { echo "<a href='URL_BASE/" . basename($FULLpath) . "'>LINK</a>"; } ?> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |