Re: Re: Functions vs html outpuit

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

 



Dave Goodchild wrote:
Thanks, that was what I needed to hear. Cheers.

On 03/09/06, Ivo F.A.C. Fokkema <I.F.A.C.Fokkema@xxxxxxx> wrote:

On Fri, 01 Sep 2006 16:44:19 +0200, M. Sokolewicz wrote:

> Dave Goodchild wrote:
>> Hi all, this may seem like a silly question, but I am creating a
library of
>> html form element generation function, for example a textarea fucntion
that
>> takes rows and cols as parameters, a function that generates a day,
month
>> and year select box, etc. My question is - is it significantly to
switch
>> off
>> the parser and emit raw html than calling a function? If it is faster
to
>> just allow the server to send the html I will not bother.
>>
>
> I'm not quite sure I understand your question. Are you asking if it's
> faster to parse and process a php script vs. a page of raw HTML?
>
> In that case, OF COURSE SERVING A RAW HTML FILE IS FASTER!!!
> Does the server have to do *anything* with the contents of the HMTL
file? no
> Does the server have to do *anything* with the contents of the PHP file?
> yes! of course! it needs to parse and process it BEFORE it can actually
> server the RESULT of that script.
>
> So, if possible, stick to raw HTML files.
> - tul

That said, if you feel that it saves you a lot of development time (like
me) to use such functions, and you're writing a basic app that will not
likely attract lots of hits, then go for it.

I use a viewForm() function, that takes an array as a argument describing
the required form, for all of my projects. Surely it's faster for the
server if you just write the HTML, but this is much easier for me to
create, edit and re-use in other projects...

Just my 2 cts.

Ivo

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




It does seem to me that a lot a pages end up with PHP in them to do stuff that could be put in raw HTML. The reason being to make the pages easier to manage and port.

I would go for the optimize late philosophy. Once you have a site running, load testing it with - eg - JMeter. If a PHP page is taking a lot of the time and it could easily be converted to static HTML, do it at that point. If you code raw HTML everywhere, then you might find that you have spent a day messing with a page that only gets hit once a day :-(

Best wishes

AJ


--
www.deployview.com
www.nerds-central.com
www.project-network.com

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