HTML escape?

Discuss the development of future releases of phpBB (phpBB 3.x minor releases) and MODing/Coding related questions.
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

HTML escape?

Postby harmlessgoat22 » 08 Jun 2008, 02:33

How can I escape some HTML from being processed? It's in a language thing for phpBB3, and I don't want it to be parsed. I tried the one thing that's used in MODX to escape HTML, but it didn't work...help please?

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: HTML escape?

Postby igorw » 08 Jun 2008, 10:57

Hi,

You simply replace < and > with &lt; and &gt;. This is also possible in XML (MODX for example), as alternative to CDATA tags. There are some more, & becomes &amp;, " becomes &quot;. This is basically what htmlspecialchars() in PHP does.

For more information take a look at this reference: http://www.w3schools.com/tags/ref_entities.asp

- we're poor!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: HTML escape?

Postby harmlessgoat22 » 08 Jun 2008, 12:41

Last night, before you responded, I tried using htmlescapevars(), and it achieved the same effect. Is this fine to use, or should I manually change the stuff?

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever

User avatar
igorw
Past Contributor
Past Contributor
Posts: 1967
Joined: 01 Jun 2006, 20:48
Real name: Igor
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: HTML escape?

Postby igorw » 08 Jun 2008, 15:42


- we're poor!

harmlessgoat22
Supporter
Supporter
Posts: 316
Joined: 18 Sep 2007, 14:35
Real name: David
Contact:

Re: HTML escape?

Postby harmlessgoat22 » 08 Jun 2008, 16:10

haha I'm so stupid...
htmlspecialchars()
...I wasn't looking at the code when I typed that post.

That's like, I can't beat my neighbor in an argument, so instead I kill his dog.
-Best English Teacher Ever


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Return to “phpBB Development discussion”

Who is online

Users browsing this forum: No registered users and 26 guests