Got a problem with the 'virtual' function

From: Date: Sat, 21 Oct 2000 05:22:34 +0000
Subject: Got a problem with the 'virtual' function
Groups: php.general 
Request: Send a blank email to php-general+get-21524@lists.php.net to get a copy of this message
I can't seem to use the virtual() function to include a JSP file. This command won't work: virtual ("/test/sample.jsp"); I'm running some preliminary tests for a project at work. I'm trying to get rid of a lot of the JSP that we have on our site and replace it with PHP. For a majority of the pages, that is easy, but on other pages I would like to use a PHP template but still have JSP pieces inside it... so I'm trying to include those pieces with the following page contents: ---------- BEGIN /test/index_jsp.html ---------- <?php srand ((double) microtime() * 1000000); printf ("<html><body><font face='arial' size=2 color='#880088'>\n"); printf ("<b>INDEX_JSP %d</b>", rand(1,10000)); printf ("</font><br>"); virtual ("/test/sample.jsp"); printf("</body></html>\n"); ?> ---------- END /test/index_jsp.html ---------- ---------- BEGIN /test/sample.jsp ---------- <%@ page contentType="text/html" session="false" autoFlush="true" %><% out.print("<font face='Verdana' size=5 color='#FF0000'>\n"); out.print("<b>JSP output " + (int)(Math.random()*10000) + "</b>\n"); out.print("</font>\n"); %> ---------- END /test/sample.jsp ---------- However this doesn't work! Instead of giving me the output of the JSP code included in the PHP output, PHP includes the source of the current page (index_jsp.html)! I don't understand this...so I proceeded to run some other tests: ---------- BEGIN /test/index_cgi.html ---------- <?php srand ((double) microtime() * 1000000); printf ("<html><body><font face='arial' size=2 color='#880088'>\n"); printf ("<b>INDEX_JSP %d</b>", rand(1,10000)); printf ("</font><br>"); virtual ("/test/sample.cgi"); printf("</body></html>\n"); ?> ---------- END /test/index_cgi.html ---------- ---------- BEGIN /test/sample.cgi ---------- #!/usr/local/bin/perl srand(time()); printf("Content-type: text/html\n\n"); printf("<font face='Verdana' size=5 color='#FF0000'>\n"); printf("<b>PERL output %d</b>\n", rand(100000)); printf("</font>\n"); ---------- END /test/sample.cgi ---------- That works! I can include the output of the PERL script with the virtual tag, but the JSP include is weird. And, yes, I did test the JSP file and it loads fine on a browser... I'm using: Server: Apache/1.3.12 (Unix) PHP/4.0.1pl2 ApacheJServ/1.1.2 Can anyone explain what I'm seeing? Dante D. Dante Lorenso Senior Web Master / Engineer dante@hearme.com

« previous php.general (#21524) next »