CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Search fld for URL's and e-mail, replace with code

Print topic Send  topic

Author Message
Carey
Posted: 02/24/2002, 5:04 AM

Could someone please enlighten me on how to search a field (fldnews in my case), and whenever it sees URL's or email addresses it will replace with the proper html anchor tags.

Thanks!!!
Nicole
Posted: 02/25/2002, 5:59 AM

Carey,
here is snippet of PHP code that surrounds url links with link html tags. Use the same approach for email addresses. Code goes in BeforeShow event. Note, that for Label fields, 'html' flag is to be selected.


$pos = strpos($fldnotes, "http:");
$newnotes = "";
if ($pos != "")
{
while (($fldnotes != "")&&($pos != ""))
{
$end = strpos($fldnotes, " ", $pos);
$url_link = substr($fldnotes, $pos, $end-$pos);
newnotes .= substr($fldnotes, 0, $pos). " <a href = '".$url_link."'>". $url_link. "</a> ";
$fldnotes = substr($fldnotes, $end+1);
$pos = strpos($fldnotes, "http:");
}
$fldnotes = $newnotes;
}

Where "notes" is field name. Note, I assume that url links are started with "http:", you may also search for url links started with "www."


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.