In article <0cdbd72c53.jim@nails.abbeypress.net>, Jim Nagel
<netsurf@abbeypress.co.uk> wrote:
> Is my mention of PHP at all relevant?
Not really.
> Is the website's PHP code
> generating Javascript?
It may be. PHP could be used for assembling pages from frequently-used
fragments which contain HTML, more PHP and Javascript; even the
statements may be assembled using PHP variables. There's really no other
link between them: the PHP script operates on the server and javascript
operates in your browser. PHP is no more at fault than if the pages were
assembled on the fly by BBC Basic. Here's a really simple PHP page from
one of my sites:
<?php
include('../shared/xhtml1t_doc');
include('news/header.htm');
[snip]
include('news/body.htm');
[Snip]
include('news/footer.htm');
?>
It constructs a news page from common elements. Things like the DOCTYPE
only have to be got right once and my frequent edits are made only to
news/body.htm. The first and other snipped fragments are used site-wide.
More complexity can be introduced with variables and conditionals to
write stuff to the HTML page which is delivered to browsers. PHP is very
useful if pages contain conditional content or PayPal and social media
buttons which can be kept discreetly and updated without having to resort
to wading though acres of HTML splat on one massive page. The complete
page isn't built by the PHP interpreter until news.php is requested.
PHP isn't a sign of anything bad: it is merely an adjunct to a web
server. But a website which relies only on Javascript for layout without
providing an alternative when it lacks in a browser is jolly bad form and
generally frowned upon. Unfortunately, now that smartphones and other
portable kit has a clutch of reasonably capable browsers which can manage
javascript any complaints these days are likely to fall on deaf ears.
--
Tim Hill
..............................................................
www.timil.com
No comments:
Post a Comment