I'm not sure I understand you 100% but it sounds like you want to get the
static HTML results of your dynamic PHP script and and do something with it.
Happily, PHP is one of the few languages that can do this with ease :-)

The feature you want is "output buffering". Output buffering _traps_ the
output, that would normally be sent to the browser, into memory. Once you
have trapped it, you can retrieve it into a variable and opptionally release
it again so that it does get sent.

I highly recommend reading the manual on it.
Gotta luv PHP ;)

OK, now that you've read the manual on it, read the following example code.

Maybe you want
ob_start(); // start trapping
include_once("menu_file.php"); // let PHP process the dynamic stuff
$output = ob_get_contents(); // get the output into a variable
ob_end_clean(); // stop trapping and  release the memory used
printf($output,$blah1,$blah2,$blah3); // make replacements and send output

As you can see, an elegant way to perform the replacements would be to use
printf() if possible. This means the the static output must have the right %
codes in the output that would normally be sent to the browser were it not
for the ob functions. http://www.php.net/manual/en/function.sprintf.php


> -----Original Message-----
> From: Brian Petro [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, 1 March 2002 6:37 AM
> Subject: [PHP] how to: variable = php parsed file include 
> I've got a site that I've used php to include the navigation 
> bar as a separate file.  Within that nav-bar is a small php 
> application.  I have no problem including the php nav-bar 
> file and it gets parsed by php and the application works.  
> The problem is that I also want to use the same file include 
> for the navigation in a dynamic "thank you" page that is 
> generated by a php-based form processor.  I'm using 
> phorm.com's php form processor which I really like.  The 
> "dynamic" "thank you" page that it generates is actually a 
> hard coded html page which phorm.php parses to replace form 
> variables.  I think my best way to do what I want is to have 
> the script grab the nav-bar file, parse it through php, then 
> take the string results and set a variable equal to that 
> string.  That way I can still use the script's built in 
> parsing that replaces form variables in the hard coded "thank 
> you" page.  Does anyone know the syntax to do this?  I 
> understand the concept, but I'm way over my head.
> Thanks!
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to