Hey I did it. A special thanks goes out to Michael Kimsal for giving me the
idea of output buffering. Here is the code I used. Hope this helps
ob_start(); // Start output bufering
include ("$filename"); //$filename is the file you want to include
$x = ob_get_contents(); //Set the contents of the output buffer to variable x
ob_end_clean(); //Stop output buffering and flush its contents without
giving output. If you want it to give out put change this line to
ob_end_flush();
Once again thanks to everyone who helped
:-)
SID
At 11:09 PM 9/9/01 -0400, you wrote:
>file() probably won't do it, unless you call an http:// file request to
>your webserver - PHP won't execute other PHP code in another file when
>pulled in thru file().
>
>What you are looking for is most likely output buffering.
>
>Read up on ob_start at php.net/ob_start. Basically turn output buffering
>on, include() the file, grab the contents from the output buffer, put them
>into $x, and clear the buffer. There should be an example or 2 at the
>website. zend.com also had an article on output buffering.
>
>
>
>--------------------
>Michael Kimsal
>http://www.tapinternet.com
>734-480-9961
>
>
>On Mon, 10 Sep 2001, Jason Brooke wrote:
>
> > > Hi,
> > >
> > > I've been trying to figure this thing out for 3 hours now. Lets say we
> > have
> > > a variable $x. Now I need to assign $x with similar output that comes
> from
> > > an include function.
> > >
> > > For anyone who did not understand me --> Instead of the stupid include()
> > > function outputing the file contents to the browser I need it to
> assign it
> > > to variable x.
> > >
> > > I am pretty sure inlude() cannot do it but is there any other function
> > > similar to include() that will process the file and then assign the
> output
> > > to a variable.
> > >
> > > Thanks in advance
> > >
> > > SID
> >
> > there's a stupid function called file() that does that
> > it's in the stupid manual - which also explains the behaviour of
> include for
> > you as well
> >
> > jason
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]