Lasso Soft Inc. > Home

[mv_stripHTML]

Linkmv_stripHTML
AuthorMarc Vos
CategoryCustom Tag
Version8.5.x
LicensePublic Domain
Posted27 Nov 2008
Updated03 Aug 2009
More by this author...

Description

Strips all HTML tags from a string.

Sample Usage

mv_stripHTML($stringvar, -encodeNONE)

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

// Strips all HTML from a string.
// Usage example : mv_stripHTML($text, -encodeNONE);
define_tag('mv_stripHTML', -required='str', -copy, -optional='tr2nl');
	local('s' = #str);
	local('tr' = #tr2nl);

	// Replace all 

with newlines #s = string_replaceregexp(#s, -find='<\\/[p|P]>', -replace='\n\n'); if(#tr == true); // Replace all with newlines #s = string_replaceregexp(#s, -find='<\\/[t|T][r|R]>', -replace='\n'); /if; // Replace all HTML tag matches with the empty string #s = string_replaceregexp(#s, -find='<(.|\n)+?>', -replace=''); // Replace all < and > with < and > #s = string_replace(#s, -find='<', -replace='<'); #s = string_replace(#s, -find='>', -replace='>'); return(#s); /define_tag;

Comments

29 Mar 2010, Dominique Guardiola Falco

Solved

OK, the tag is fine, it's just this microsoft html tags crap again through FCkEditor....

29 Mar 2010, Dominique Guardiola Falco

Does not work everywhere ???

I really dont' get it but have no time to investigate :
works on my dev machine but crashes the lasso site on the prod server...

22 Aug 2009, Dominique Guardiola Falco

tr2nl not really optional

Just modify line 5 :
local_defined('tr2nl') ? local('tr' = #tr2nl) | local('tr' = false);

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft