Re: Creating an Entire .html page with PHP
| From: | clancy_1 at cybec dot com dot au | Date: | Wed, 27 Jan 2010 06:09:59 +0000 |
| Subject: | Re: Creating an Entire .html page with PHP | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-301528@lists.php.net to get a copy of this message | ||
On Tue, 26 Jan 2010 18:52:06 -0800, daevid@daevid.com ("Daevid Vincent") wrote:
............
>First of all writing pages in this old fashioned .cgi sort of way is so
>1990's. Concatenating your whole page to a giant string is silly and
>defeats the benefits (and purpose) of using PHP.
>I'm actually in the process of porting a HUGE site from that style to a
>more sane MVC and PHPish way right now. It makes me cringe every day I have
>to look at 'old' code.
I suggest you read the question that started all this.
I don't know why you should want to store a compiled page, but someone asked how they
could do it, and I have suggested one way. PHP doesn't seem to have any problems with
long strings (file_put_contents & file_get_contents actually treat the contents as a
string, and they don't slow down till the length grows past ~100k), so if you did, this
would work as well as any other way.
And however you generate a web page, it is effectively sent to the browser as a string
(which can include linefeeds and all the rest) so this would work regardless of whatever
fancy tricks you used to generate it.
(And I don't open HTML e-mails if I can possibly avoid it.)