interminglingly xml AND php
Posted: Mon Sep 16, 2002 9:26 pm
I have created a system that uses PHP's XML parsing engine just fine. My system is a template based web-publishing system where the content file for each page can be a simple include (where PHP and HTML can be mixed together), the content can also be an external resource, or the generated output of some class file, or (drum roll please) the content can be marked up in XML tags.
In the last case, the system (aka the man behind the curtain) fires up the Expat XML parser, and reacts to the content of the tags. In case the content includes PHP code, that code is eval()'d, so that I can add server-side logic and content inside my XML document.
The problem is that the XML parser seems to lose all scope of any previously created functions, but also doesn't allow functions to be redeclared. For example, lets assume that my XML content file is
lets also assume that in the head of my template, I include a library of php code that contains the definition for the display_table function. The XML parser complains that it knows nothing of display_table. However, if I redeclare display_table inside the content file (where all PHP code is eventually eval()'d by the parser), the parser complains that I can't redeclare.
I'm wondering if JavaServlets and/or beans etc. can do this. I do not know JSP at all. I'm wondering if PHP can do this. Any idea?
If you go to http://test.freephile.com/company/index.php, then click on the "Open Source" icon, you can view some of the source. The whole system is GPL'd code, but I haven't polished it up enough to release the whole thing yet. Any advice is welcome.
Thanks,
Greg Rundlett
In the last case, the system (aka the man behind the curtain) fires up the Expat XML parser, and reacts to the content of the tags. In case the content includes PHP code, that code is eval()'d, so that I can add server-side logic and content inside my XML document.
The problem is that the XML parser seems to lose all scope of any previously created functions, but also doesn't allow functions to be redeclared. For example, lets assume that my XML content file is
Code: Select all
<content>
<story>
Blah, blah blah We have great stuff, see the table below for a list of products
їcolor=red]<?php display_table($productSheets) ?>ї/color]
</story>
<related>
</related>
<quote>
</quote>
</content>I'm wondering if JavaServlets and/or beans etc. can do this. I do not know JSP at all. I'm wondering if PHP can do this. Any idea?
If you go to http://test.freephile.com/company/index.php, then click on the "Open Source" icon, you can view some of the source. The whole system is GPL'd code, but I haven't polished it up enough to release the whole thing yet. Any advice is welcome.
Thanks,
Greg Rundlett