Page 1 of 1

Stripping HTML with nVelocity?

Posted: Tue Jan 19, 2010 5:05 pm
by mwolf
Is it possible to use velocity to strip HTML tags? I'm trying to remove HTML tags from $Product.Description on 'Show Product 1.htm' and I've tried a number of different ways and it doesn't seem to be working.

Neither of these work:

Code: Select all

$Product.Description.Replace("</?[^>]+/?>", "");
$Product.Description.replaceAll("</?[^>]+/?>", "");
Any other suggestions?

Re: Stripping HTML with nVelocity?

Posted: Tue Jan 19, 2010 6:29 pm
by jmestep
Other suggestions:
You might have to move some of the code from a scriplet into a conlib where you can use Able's StringHelper.StripHtml. Or maybe a class file, like in the W2MSEOHelper.cs.

Re: Stripping HTML with nVelocity?

Posted: Wed Jan 20, 2010 12:24 pm
by mazhar
I think Judy's approach is more appropriate. NVelocity should be only used for data display formatting. If you use it frequently for complex programming purpose it can slow down the pages.