Re: Embedding HTML Within a PHP Statement [message #175987 is a reply to message #175985] |
Mon, 14 November 2011 12:30 |
Tim Streater
Messages: 328 Registered: September 2010
Karma:
|
Senior Member |
|
|
In article <4ec0f420$0$6915$e4fe514c(at)news2(dot)news(dot)xs4all(dot)nl>,
Erwin Moller
<Since_humans_read_this_I_am_spammed_too_much(at)spamyourself(dot)com> wrote:
> I don't think that approach is very recommendable.
> At least not as a general recipe.
It won't cover many situations, I agree.
> A few drawbacks:
> - Your full ajax approach results in multiple requests to the server
> (where one request would suffice without AJAX.).
I would rather eat three correctly-sized meals a day than one very big
meal once a week.
> - It also demands the client to have Javascript enabled.
Yes, and so what. My application has 7500 lines of PHP and 12000 or so
lines of javaScript. I see no prospect of being able to replace the
JavaScript by some clever CSS.
> - Many searchengines and their associated crawlers don't execute
> Javascript, so they will be blind for that fetched content.
While some might, and with good reason, personally I don't take the
needs of search engines into account.
> - In many cases the back button will give unexpected results, and
> bookmarking a page becomes a guessing game.
Mmm. In everything you say here, you make the mistake of assuming that
PHP, browser, JavaScript are components that can *only* be used in a
traditional browser-on-my-computer, server-somewhere-remote scenario.
This is an error.
> I also fail to see why you claim "much cleaner for the user POV".
Because reloading a page is messy and slow from the user's PoV. Instead
you can use AJAX to respond in a much more timely way depending what
they are doing. Or validate their form as they are entering it, or do
something like a postcode or address lookup. And yes, in most instances
you can offer a degraded approach in the case where the user *has*
turned off JS, but then they get a poorer service and may not understand
why.
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
|
|
|