Can anyone help me with some PHP?

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
OK there might be an obvious answer to this, but I'm a Java and C programmer really, so this is slightly unfamiliar. Anyway here goes...

I am developing a CMS where the data is held in a database and the page structure is held in an XSL sheet. I transform the XSL with PHP to get some HTML which is printed out with WYSIWYG editors added for editing in the CMS. Publishing pages works in the same way, but without adding the editors, and the HTML is written to a file rather than printed in the CMS page.

//cms stuff

$HTML = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters);

//...

echo $HTML;

//cms stuff


No problem with that, but, what if the XSL contains something like this?

<![CDATA[<?php include 'left_nav.php'; ?>]]>

When published to a file, this works fine, because the PHP is processed when the page is loaded, but when printing to the CMS page it simply writes...

<?php include 'left_nav.php'; ?>

...literally, without processing it.

Is there any way I can reprocess the $HTML variable so the include is actually included in the CMS page?

 

Atheus

Diamond Member
Jun 7, 2005
7,313
2
0
Originally posted by: sourceninja
Never done it personally, but I would suspect you need to use eval() http://us3.php.net/eval

Parse error: syntax error, unexpected '<' in /public_html/cms/page.php(272) : eval()'d code on line 1

Also I noticed that the XSLT processor is outputting the CDATA section as:

& lt;?php include 'left_nav.php'; ?& gt;

not:

<?php include 'left_nav.php'; ?>


so I am now using:

<xsl:text disable-output-escaping="yes">
<![CDATA[<?php include 'left_nav.php'; ?>]]>
</xsl:text>


but it hasn't helped - I still get & lt; & gt;