• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Can anyone help me with some PHP?

Atheus

Diamond Member
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?

 
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;
 
Back
Top