Re: [PHP] Pregenerating Script

2002-01-31 Thread David Otton

On Thu, 31 Jan 2002 22:28:59 +0530, you wrote:

  I want a php script which takes 4 parameters :

  - header file
  - body file
  - footer file
  - OUTPUT file 

  What it should do is combine 1. header, 2. body, and 3. footer and save it as 4. 
OUTPUT file 

Is

cat header body footer  output

too simple? Any reason why it has to be PHP? Suppose you could do :

?
$header = header.txt;
$body = body.txt;
$footer = footer.txt;
$output = output.txt;
exec(cat $header $body $footer  $output);
?

djo


-- 
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]




RE: [PHP] Pregenerating Script

2002-01-31 Thread Kevin Stone

Sound like the perfect job for Output Buffering.  I only recently
learned about these functions and they're great!  There are four
functions you need to be aware of..

ob_start() Starts output buffering anything going out to the screen is
routed to the buffer.
ob_flush() Outputs the entire buffer.
ob_clean() Cleans the buffer.
ob_get_contents() Setting this to a variable will put the contents of
the buffer into that variable.

What you can do to combine all headers and page elements then
essentially blit the whole thing to the screen is this...

ob_start();
header(whatever);
header(whatever);
include(header.html);
include(footer.html);
ob_flush();

Yes I believe it really is that simple.  :)  Will only work with the
most recent versions of PHP but I hope it helps.  Good luck.

--
Kevin Stone
[EMAIL PROTECTED]
www.helpelf.com



 -Original Message-
 From: karthikeyan [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, January 31, 2002 9:59 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Pregenerating Script
 
 Hi Guys,
 
   I want a php script which takes 4 parameters :
 
   - header file
   - body file
   - footer file
   - OUTPUT file
 
   What it should do is combine 1. header, 2. body, and 3. footer and
save
 it as 4. OUTPUT file
 
   How do i do that.
 
   Any help with sampe code will be greatly appreciated.
 
   Regards,
 
 karthikeyan b



-- 
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]




Re: [PHP] Pregenerating Script Again

2002-01-31 Thread Jason Wong

On Friday 01 February 2002 03:52, karthikeyan wrote:
 Hi Guys,

   I got some sweet responses like using cat and using Output Buffering
 functions.  But then what i really want is to provide user with the
 interface like this :

 Pregeneration Program
 ---

 Step 1 - Choose you Header file [ ]   [Browse] - here they will
 choose the header file

 Step 2 - Choose you Body file [ ]   [Browse] - here they will
 choose the content body file

 Step 3 - Choose you Footer file [ ]   [Browse] - here they will
 choose the footer file

 Step 4 - Please give the output File Name [  ] - The file can
 be saved in the same directory where this program is running

 [ Generate ] - This is a button

   When they press generate then step4 file should be created combining the
 step1, step2 and step3 files.  Obviously this will take them to the  next
 page where this operations will be carried out the then they will be shown
 the succes or failure.

   Hope now you understand what i really want.

You're still not making it clear what you want. 

Are the header/body/footer files just plain text? 

If yes, then cat will do.

Do they contain php that needs to be interpreted?
If so, then does the user need to see the results, or just a simple 
SUCCESS/FAILED?

Etc.



-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The moving cursor writes, and having written, blinks on.
*/

-- 
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]