Jump to content

unescaped XHTML as a variable?


cperkins

Recommended Posts

I have a PHP document that has a small block of XHTML in it that I need captured in a PHP variable.  But, since this page needs to be relatively easy for end users to edit, I would prefer to not use escaped XHTML.

For example, this is what I want to avoid:

$myvar = "<p>some text<a href=[b]\"[/b]go/home.html[b]\"[/b] onclick=[b]\"[/b]javascript:alert('hi');[b]\"[/b]>click me</a></p>"

I really need the XHTML to  have double quotes in it (for attributes), as well as single quotes and slashes, without them being escaped.  But I also need this block bound in a variable.

I could place the XHTML in an external file, unescaped, and just read the file. But I'm afraid this will confuse my end users, which won't know where to look for their text.


For a minute, I was hoping the Simple XML parser might do the trick:  [b]<<<XML .... XML; [/b] 
Because, XHTML is valid XML, but it didn't seem to work and I'm having difficulty finding documentation about the [b]<<<...[/b] special form itself.

Any guidance or insight appreciated. 

Chris Perkins
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.