preprocessing view.xhtml with PHP for dynamic scripting

classic Classic list List threaded Threaded
3 messages Options
DL
Reply | Threaded
Open this post in threaded view
|

preprocessing view.xhtml with PHP for dynamic scripting

DL
I have followed the principles in /xforms-jsp/  (preprocessing JSP scripts)
to create a similar /xforms-php/ directory (preprocessing PHP scripts).
I'm using the quercus.caucho.com resin.jar copied into /WEB-INF/lib as the PHP servlet
and references to Quercus Servlet are added into web.xml.

That actually works very nicely ..
e.g. http://localhost:8080/orbeon/xforms-php/hello.php
renders in browser.
...

But now I want to extend PHP preprocessing to apply to apps in
/orbeon/WEB-INF/resources/apps/myapp/    ... and not /xforms-php/  folder.

I hope to use PHP scripting in apps to dynamically create paths to eXist database in an xform instance and layout of xform.

...

In web.xml do I have to uncomment the <context-param> for filesystem resource manager?

In /orbeon/WEB-INF/resources/apps/myapp folder ..
The view.xhtml file becomes view.php (echoing xhtml as in php content-header after preprocessing)
The page-flow.xml file has <page view="view.php" ..  instead of <page view="view.xhtml"

http://localhost:8080/orbeon/myapp/     should then hopefully preprocess PHP in view.php and work as though view.xhtml had been run.

<i>PHP code:-
header("Content-type: application/xhtml+xml");
$string='<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" ... etc.</i>

Do I have to enable filesystem resource manager section in web.xml?

A link to a general tutorial on configuring web.xml for PHP (or for others it could be JSP) preprocessing in apps would help.   e.g. When should the web.xml sections be uncommented?

Thanks.
DL
Reply | Threaded
Open this post in threaded view
|

Re: preprocessing view.xhtml with PHP for dynamic scripting

DL
This post was updated on .
I've now read this ..

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-advanced-submissions

and I can (partly) achieve my dynamic scripting by calling a sample-data.php proxy which returns XML (e.g. data from eXist database) via REST interface:-

in view.xhtml ..

                     
<xforms:submission id="sample-data-submission"
            method="get"
            serialization="none"
            resource="http://localhost:8080/orbeon/xforms-php/sample-data.php"
            replace="instance"
            instance="books-instance"/> 


This proxy could equally be located in a remote PHP Apache server and not in a Quercus PHP servlet on tomcat ..

so by using a proxy I'm not really achieving the close integration of PHP and page flow controller I had hoped for in my first post above.

Any ideas on integrating PHP closely into the apps (as in /xforms-php/hello.php .. but in URL-pattern /orbeon/myappname/)?

The exception error seems to be at line 34  in /orbeon/WEB-INF/resources/page-flow.xml ...

<page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>

Is it xforms-submission-path property in property.xml I should now be looking at?

Reply | Threaded
Open this post in threaded view
|

Re: Re: preprocessing view.xhtml with PHP for dynamic scripting

Erik Bruchez
Administrator
> I've now read this ..

>
> http://wiki.orbeon.com/forms/doc/developer-guide/xforms-advanced-submissions
>
> and I can (partly) achieve my dynamic scripting by calling a proxy.php which
> returns XML (e.g. data from eXist dataase) via REST interface:-
>
> in view.xhtml ..
>
>
> <xforms:submission id="sample-data-submission"
>            method="get"
>            serialization="none"
>
> resource="http://localhost:8080/orbeon/xforms-php/sample-data.php"
>            replace="instance"
>            instance="books-instance"/>
>
>
> This proxy could equally be located in a remote PHP Apache server and not in
> a PHP servlet on tomcat ..
>
> so by using a proxy I'm not really achieving the close integration of PHP
> and page flow controller I had hoped for in my first post above.
>
> Any ideas on integrating PHP closely into the apps (as in
> /xforms-php/hellp.php .. but in URL path /orbeon/myappname/)?
>
> The problem seems to be at line 34  in
> /orbeon/WEB-INF/resources/page-flow.xml ...
>
> <page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher"
> model="apps/${1}/page-flow.xml"/>
>
> Is it xforms-submission-path property in property.xml I should be looking
> at?
When you reach a URL handled by the Orbeon Forms controller (PFC), the
controller runs an XML pipeline based on what's described in
page-flow.xml. It sticks together page model, view, and epilogue.
Model and view can be plain XML, XSLT, or XPL (XML pipelines).

The question you need to answer first is: where in that process should
PHP intervene?

Then, you can look at figuring out how to plug Quercus.

I would imagine that it would be at the level of the page model and/or
page view: in addition to process XML, XSLT, or XPL, PHP would be an
option.

But this would require changes to the PFC implementation, and also
create an XML processor based on Quercus. It doesn't look like just
using the Quercus servlet will work.

-Erik


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws