I'm trying to pull HTML code into a form textarea however I actually want the code to be displayed and not the formatting.
i.e. <font color="#FF0000;">Hello World</font> needs to be displayed as <font color="#FF0000;">Hello World</font> and not red text that says Hello World.
Thanks in Advance
Viewing HTML code in a textarea
Moderator: General Moderators
-
fatfishmatt
- Forum Newbie
- Posts: 5
- Joined: Thu Aug 25, 2005 9:43 pm
-
fatfishmatt
- Forum Newbie
- Posts: 5
- Joined: Thu Aug 25, 2005 9:43 pm
I've developed a CMS with a WYSIWYG editor so consider the following scenario:
If I want to write some text formatting on my site to make a certain word red I highlight the word and the WYSIWIG editor will wrap the HTML code into the textbox. Within the text box I'll then see <font color="red">Hello World</font>
I then save the page and this gets written to my site...... fine and dandy.
The problem is then when I want to edit my text again. When I click the text editing tool the textarea pops up with 'Hello World' in red and not Hello world with the HTML font tag wrapped around it. Because my save function reads the textarea and sees no HTML formatting when it writes back to the site again the formatting is neglected.
So....... the problem being is that when I bring up the text to edit I need the textarea to display all HTML tags.
Again thanks in advance...
If I want to write some text formatting on my site to make a certain word red I highlight the word and the WYSIWIG editor will wrap the HTML code into the textbox. Within the text box I'll then see <font color="red">Hello World</font>
I then save the page and this gets written to my site...... fine and dandy.
The problem is then when I want to edit my text again. When I click the text editing tool the textarea pops up with 'Hello World' in red and not Hello world with the HTML font tag wrapped around it. Because my save function reads the textarea and sees no HTML formatting when it writes back to the site again the formatting is neglected.
So....... the problem being is that when I bring up the text to edit I need the textarea to display all HTML tags.
Again thanks in advance...
Code: Select all
htmlentities();
html_entity_decode();-
fatfishmatt
- Forum Newbie
- Posts: 5
- Joined: Thu Aug 25, 2005 9:43 pm
No.... it's getting saved fine.
The problem arises when I try to edit the text that I've just formatted. A pop-up window appears and loads the text into a textarea. This text then displays the formatting which is not what I wat it to do. It needs to display the actual HTML code
i.e. <font color="red">Hello World</font> needs to be displayed exactly as is, HTML tags and all. I don't want it to display red text that reads 'Hello World'
The problem arises when I try to edit the text that I've just formatted. A pop-up window appears and loads the text into a textarea. This text then displays the formatting which is not what I wat it to do. It needs to display the actual HTML code
i.e. <font color="red">Hello World</font> needs to be displayed exactly as is, HTML tags and all. I don't want it to display red text that reads 'Hello World'
-
fatfishmatt
- Forum Newbie
- Posts: 5
- Joined: Thu Aug 25, 2005 9:43 pm