Page 1 of 1
Quote HTML tags
Posted: Thu Oct 31, 2002 3:01 am
by Shrike
I've had a look through the snippets at evil walrus but they all deal with quoting whole pages - I just want a little function which will allow me to quote html tags whenever I need to.
Anyone help?
Posted: Thu Oct 31, 2002 3:02 am
by twigletmac
Not sure exactly what you mean do you mind explaining a bit more what you are trying to achieve.
Mac
Posted: Thu Oct 31, 2002 4:19 am
by Shrike
Well, I've noticed on evil walrus that there are snippets that give your visitors the ability to click a button and see the source of the whole page they clicked the link from - I just want to be able to quote HTML tags without using those hard to remember symbols.
I'm not sure if this can be done with client-side which is why I'm posting it here.
Posted: Thu Oct 31, 2002 4:27 am
by twigletmac
OK, I think what you want to do is have things like
Code: Select all
<p><b>Hello world</b></p>
visible to the user's without have to write out all the <'s and >'s. In that case you can use PHP to convert the tags so that instead of interpreting them the browser displays them:
Code: Select all
$html = '<p><b>hello world</b></p>';
echo htmlspecialchars($html);
htmlspecialchars() will change any <'s, >'s, &'s and "'s to their entity version (<, >, &, ").
Mac
Posted: Thu Oct 31, 2002 8:22 am
by Shrike
That is exactly what I wanted!
Cheers!