You are here: Re: curious (and frustrating) php/apache behavior « PHP « IT news, forums, messages
Re: curious (and frustrating) php/apache behavior

Posted by Petr Smith on 10/29/05 22:19

Hi,

why don't you use normal php include (require) functions? Why do you
want to mix apache server side includes with php code? There is nothing
php include can't do..

Just change all

<!--#INCLUDE virtual="xxxx"-->

to

<? include('xxxx'); ?>

Petr

Don Brown wrote:
> We're having a problem getting more than one imbedded PHP script to execute in our Apache-served pages. We're using Apache 2.0.40 server-side includes. We wish to include multiple PHP scripts into our pages but are only succeeding in having the first included PHP script executed; the rest are ignored or misinterpreted as HTML...
>
> Thank you in advance for any help you provide.
>
>
> This works:
>
> $ cat php1.txt
> <?php
> echo "this is the first php include";
> ?>
> $ cat test.shtml
> <html><body>
>
> <!--#INCLUDE virtual="/php1.txt"-->
>
> <br>this came from html
>
> </body></html>
>
> Producing the expected result from the browser (http://myhost/test.shtml):
> this is the first php include
> this is html
>
> However, this does not produce the expected three line result:
>
> $ cat php1.txt
> <?php
> echo "this is the first php include";
> ?>
> $ cat php2.txt
> <?php
> echo "this is the second php include";
> ?>
> $ cat test.shtml
> <html><body>
>
> <!--#INCLUDE virtual="/php1.txt"-->
> <br>
> this came from html
> <br>
> <!--#INCLUDE virtual="/php2.txt"-->
>
> </body></html>
>
> Producing from the browser (http://myhost/test.shtml):
> this is the first php include
> this is html
>
>
> This DOES work:
>
> $cat test.php
> <html><body>
>
> <?php
> echo "this is from the first php block";
> ?>
>
> <br>
> this is from html
> <br>
>
> <?php
> echo "this is from the second php block";
> ?>
>
> </body></html>
>
> Producing from the browser (http://myhost/test.shtml):
> this is from the first php block
> this is from html
> this is from the second php block
>
>
> Don Brown
> Co-Founder, Utah Skies
> "Ski champagne powder by day, surf diamond-studded velvet by night..."
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация