Re: Creating an Entire .html page with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 25 Jan 2010 18:31:54 -0800, dealtek@xxxxxxxxx ("dealtek@xxxxxxxxx") wrote:

>
>On Jan 25, 2010, at 6:23 PM, Shawn McKenzie wrote:
>
>> file_put_contents() is soooo much easier.
>
>Thanks Shawn I'll check that out ...
>
>- I see it says : This function is identical to calling fopen(),  
>fwrite() and fclose() successively to write data to a file.
>
>
>my newbie brain likes that!
>
>
>Thanks,
>dealtek@xxxxxxxxx
>[db-10]

In principle this is extremely simple. Take your existing procedure to generate the page
then:

1. $page = '';

2. Replace every echo 'whatever'; statement with $page .= 'whatever';, and every <html>
with $page .= '<html>';

3. file_put_contents($page,$file) // The manual is down (again!) and I have forgotten the
format.

4. echo( file_get_contents($file));  // to generate the PHP page.

However I strongly suspect that it is possible to simply redirect all the 'echo's in your
existing procedure to write to $page (or $file?), without changing the code at all. Is
this so?

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux