We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question, Api

PerchUtil::html() or HTML->encode()

Hey Drew. In working on a couple new apps I have begun to wonder when to use one or the other...

PerchUtil::html() or HTML->encode()

I have looked through official Perch Apps and of course I see both being used. I have noticed when your inside php tags you'll use HTML->encode() and if your just using a short php echo within html you seem to use PerchUtil::html()...

Can you explain when to use each? When I look at the actual class.php for each I see they both use the same final class method.

Robert Ketter

Robert Ketter 103 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Use HTML->encode().

PerchUtil::html() isn't really part of the public API.