I'm pulling an RSS feed into my landing page using code similar to this:

So, I've got all that code sitting inside a single variable right now. When I print out that single variable on a landing page, I get nicely-formatted HTML, and the HTML displays very nicely.

But, I really want the HTML code to be converted into a string so that the browser won't try to interpret and display the formatted HTML. I'd like to just print a big block of HTML code inside my landing page.

Isn't there some sort of functionality where I can turn a chunk of HTML into a string?

How would you accomplish this? Is it even possible to do this with AMPScript?

Edit: I can't delete this question, but I didn't explain the problem clearly enough or specifically enough to allows others to offer useful advice. I'll need to think of a better way to state the question and repost.

  • I think that I need to repost and rephrase the question. – Eric Nov 14 '14 at 15:14

Wrapping the @html variable in <xmp> worked for me:


Source: https://stackoverflow.com/questions/1756164/how-to-print-code-on-html


How about just parsing the HTML and replacing the "<" and ">" characters with HTML entities -- before you display it on the page?


var @html
set @html = "<table><tr><td>whee!</td></tr></table>"
set @html = replace(replace(@html,">","&gt;"),"<","&lt;")



Trying wrapping that string in TreatAsContent()


  • TreatAsContent() just forces the AMPScript to be evaluated. – Adam Spriggs Oct 31 '14 at 20:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.