You are not logged in.
Pages: 1
I'm using Xinha as an editor for some content and people here aren't totally html smart. So I offer some instructions on what to type to get php to output something. This Text is stored a MySQL DB.
So, if the data out of MySQL DB contains:
<p> This is a test content!
</p>
<p>This is super duper cool.
</p>
<p>Can we do php?
</p>
<p><? echo "yes we can!"; ?>
</p>
And I put that in the textarea to edit, Xinha removes the php code and gives the user:
<p> This is a test content!
</p>
<p>This is super duper cool.
</p>
<p>Can we do php?
</p>
<p>
</p>
Anyway to make Xinha not do this?
Offline
You have to use the GetHtml plugin and only insert PHP with long script notation if you want to use PHP in Xinha. If you are inserting existing content into Xinha that already has <? or <?php notation, you must run your code through a regular expressions before sending it into Xinha to convert it into notation with standard script tags. I use the php below on the page that loads Xinha and it works perfectly.
// prevent browser DOM from changing short PHP notation to comments, etc
$text_box=ereg_replace("<\?php ","<script language=\"PHP\">",$text_box);
$text_box=ereg_replace("<\? ","<script language=\"PHP\">",$text_box);
$text_box=eregi_replace(" \?>","</script>",$text_box);
Be aware that not everything will be safe, especially in full page mode. Anywhere (such as various locations in the head) that Xinha would remove or relocate a javascript, it will also do the same to your PHP. Sometimes you can prevent this from happening by placing the PHP inside an HTML comment, but then anything you echo or include will be inside a comment... so your echo may have to start with a comment close and end with a comment open.
Offline
You can also now use the specialReplacements feature like this:
xinha_config.specialReplacements = { '<?php' : '<script language=\"PHP\">', '<?' : '<script language=\"PHP\">', '?>' : '</script>' };
Hypercubed
website: [url=http://www.hypercubed.com/]www.hypercubed.com[/url]
blog: [url=http://blog.hypercubed.com/]blog.hypercubed.com[/url]
Offline
Pages: 1