Stripping HTML with nVelocity?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
mwolf
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 50
Joined: Mon Jul 02, 2007 9:37 pm
Location: Chicago, IL
Contact:

Stripping HTML with nVelocity?

Post by mwolf » Tue Jan 19, 2010 5:05 pm

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?

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Stripping HTML with nVelocity?

Post by jmestep » Tue Jan 19, 2010 6:29 pm

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.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Stripping HTML with nVelocity?

Post by mazhar » Wed Jan 20, 2010 12:24 pm

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.

Post Reply