On 4 Dec 2010 at 12:00, resin-interest-requ...@caucho wrote:

 
> ------------------------------
> 
> Message: 2
> Date: Fri, 03 Dec 2010 13:49:39 -0800
> From: Scott Ferguson <[email protected]>
> Subject: Re: [Resin-interest] header('Location: $url')  in quercus ..
> To: General Discussion for the Resin application server
>       <[email protected]>
> Message-ID: <[email protected]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> DL wrote:
> > A simple text string (later to be more complex xhtml format) is 
> > written into a file in another directory .. and then browser should 
> > redirect to $url
> >
> > .. but why does this not redirect in quercus?
> >
> > It seems that header('Location: $url'); is not working in quercus.
> 
> You need to use double quotes in PHP to get variable interpolation:
> 
>   header("Location: $url");
> 
> Single quoted strings don't interpolate variables.
> 
> -- Scott
> >
> > [code]
> > <?php
> > $your_data = "This is test string written to myfile.xhtml";
> > $directory = "../path-to-file-directory/";
> > $filename = "myfile.xhtml";
> > $fp = fopen($directory.$filename, "w");
> > fwrite($fp, $your_data);              // this file create works o.k. 
> > in quercus
> > fclose($fp);
> > $url = 'http://www.google.com';
> > header('Location: $url');              // this is not working in 
> > quercus embedded in orbeon
> > exit();
> > ?>
> > [/code]
> >
> > dl
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > resin-interest mailing list
> > [email protected]
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
> >   
> 
------------------------------------------------------------------------------------------

Thanks for spotting that basic error .. although single quotes seemed to work 
o.k.
in Apache + PHP

I can now take it forward and test integration of quercus into orbeon xforms 
for dynamic 
xform creation.         http://www.orbeon.com

The quercus php code is run in /xforms-php/ folder created .. similar to 
/xforms-jsp/

I did try to pre-process php code embedded inside orbeon xhtml code but I can't 
get that to 
work.   The quercus php interpreter doesn't kick in if apps are in 
/resources/apps/

They first go through Form Runner which expects xml format output.

So the next best thing is to create xhtml and other xforms files from a php 
only environment 
in /xforms-php/) which are then run ... although I know that will create 
session and caching 
problems.   It is intended to be used more in an IDE environment to create new 
xforms 
templates.

I would still prefer to have php code pre-processed inside xhtml xforms rather 
than having to 
rewrite the extire xhtml file.

Take a look at the resources/apps/xforms-sandbox/samples/    

and the question is how can php code be embedded in any of the example xhtml 
files and 
then run dynamically through orbeon server?


An example of an xforms app call is

http://localhost:8080/orbeon-CE/xforms-sandbox/sample/fibonacci

Can fibonnaci.xhtml (or other sample applications) have a php snippet embedded 
to be 
rendered in XForms Viewer?    
[Note .. the .xhtml suffix is dropped by the page-flow-controller].

....

These are the steps I have taken so far  .. (might be a few others I've 
overlooked)

*   downloaded orbeon-CE.war to place in tomcat webapp

*   copied quercus.jar and resin-util.jar into orbeon-CE Web-Inf/lib directory

*   in orbeon-CE Web-inf/config        enable properties-local.xml

*   in properties-local.xml enable xforms.inspector:-

     
http://sites.google.com/a/orbeon.com/forms/doc/developer-guide/xforms-xforms-inspector
 

     <property as="xs:boolean" name="oxf.epilogue.xforms.inspector" 
value="true"/>

*   create /xforms-php/ folder at same level as /xforms-jsp/ folder.   Insert 
phpinfo.php and 
    test.

     http://localhost:8080/orbeon-CE/xforms-php/phpinfo.php
    
*   go to Web-inf/web.xml and add ..


    <!-- Quercus servlet definition -->
    <!-- requires quercus.jar and resin-util.jar copied into lib directory -->

        <servlet>
        <servlet-name>Quercus Servlet</servlet-name>
        <servlet-class>com.caucho.quercus.servlet.QuercusServlet</servlet-class>
        <init-param>
          <param-name>license-directory</param-name>
          <param-value>Web-inf/licenses</param-value>
        </init-param>
        </servlet>


        <servlet-mapping>
        <servlet-name>Quercus Servlet</servlet-name>
        <url-pattern>*.php</url-pattern>
        </servlet-mapping>


.........

I guess another option to try might be to run orbeon-CE as a webapp on resin 
server to get 
the benefit of quercus with xforms.

dl
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to