FullQualUrl(mytext, relpage, FQHost)
Last updated November 02, 2001
Version: 1 | Requires: CF5 | Library: UtilityLib
Description:
Replace relative url's with a fully qualified URL within HREF tags. Handy for when you syndicating content to clients.
Return Values:
Returns a string.
Example:
<cfscript>
RelPage="index.cfm";
FQHost="http://www.yoursite.com";
// some text you want to parse
mytext="blah blah blah <a href=""index.cfm"">Home</a> blah blah blah ";
</cfscript>
<cfoutput>
Starting text:<br>
#mytext#<br>
<br>
<br>
Ending:<br>
#FullQualUrl(mytext,relpage,fqhost)#<br>
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
mytext | The string to search. | Yes |
relpage | The page to qualify. | Yes |
FQHost | The fully qualified host. | Yes |
Full UDF Source:
/**
* Replace relative url's with a fully qualified URL
*
* @param mytext The string to search.
* @param relpage The page to qualify.
* @param FQHost The fully qualified host.
* @return Returns a string.
* @author Ryan Thompson-Jewell (thompsonjewell.ryan@mayo.edu)
* @version 1, November 2, 2001
*/
function FullQualUrl(mytext,RelPage,FQHost) {
var tmp=rereplacenocase(mytext,"(href\=){1}([""|'| ]*)(/)*(#RelPage#){1}","\1\2#FQHost#/#RelPage#","ALL");
return tmp;
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016