Brian Dunning's FileMaker Custom Functions

EncodeURLs ( text )

Convert text with URL's into hyperlinks for use in a webviewer.

  Average rating: 4.3 (31 votes) Log in to vote

Menno van Beek   Menno van Beek
Van Beek Zakelijke Software
https://www.vbzs.nl

Share on Facebook Share on Twitter

  Sample input:
Find URL in text like http://www.filemaker.com and also multiple URL's will be found: https://community.filemaker.com/welcome make sure a space is always at the end of a URL
  Sample output:
Find URL in text like http://www.filemaker.com and also multiple URL's will be found: https://community.filemaker.com/welcome make sure a space is always at the end of a URL

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Simple convert text with URL's into hyperlinks for use in a webviewer. It's easy to add protocols like mailto, fmp etc. Also ¶ are converted into
. Function is intended for use with a webviewer. This function does not create html from text.

 

Comments

Papapepperoni   Papapepperoni, Oss, Netherlands
Apr 29, 2015
I have tried it, without any modifications, but get no result. Is there something wrong?
 
Menno van Beek   Menno van Beek, Van Beek Zakelijke Software
Apr 29, 2015
I tried to replicate your finding on MacOS and Windows, but with the identical result:

I copied the code from this website into the function-definition-window, named the function: "EncodeURLs" and added one parameter named "text".

Then I opened a dataviewer and pasted:
EncodeURLs ( "Encode URLs in text like http://www.filemaker.com" )

The result was encoded text:
Encode URLs in text like <a href="http://www.filemaker.com" target="_blank">http://www.filemaker.com</a>

I also posted this same function on a dutch forum: http://www.clarify.net/viewtopic.php?f=46&t=9025&start=9#p53531 (but you'll have to subscribe and login there to be able to get the file)
 
Papapepperoni   Papapepperoni, Oss, Netherlands
Apr 30, 2015
Thanks, I looked into your example I now understand that the following additions are necessary to get it working:

"data:text/html,<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>" &

EncodeURLs ( text ) &

"</body></html>"
 
Menno van Beek   Menno van Beek, Van Beek Zakelijke Software
May 1, 2015
The process of pouring text into a full HTML-page is a total different story. A user may want put the result in a paragraph and assign some styles to it, either inline or with a css. However that's beyond the scope of this function, because it only does what the name "EncodeURLs" suggests. It is only intended to convert URL's in a text to html-encoded URL's, hence this function is not called "ConvertToHTML".

Thank you for your comments
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Under construction. Email me your wish list for improvements.