Following on from Michael's message. . .
>Hi,
A quick and most likely simply question about which is generally better
programming with PHP. Is it more proper to break out of PHP code to write
HTML, or is it ok rto do it within print() statements? Such as...
Of course there is no 'best', 'best practice' or 'proper' [Hey will
posters /please/ stop asking for 'best practice'!]
Personally I _write in PHP_ and so print() everything. This gives you
the flexibility to stop hard-coding any time you please.
For example :
$address = "57 High St., Huddersfield"; // could be define()
print("You can visit us at $address Monday to Friday 9 - 5");
$address can be derived from an include/configuration file. This means
there is one more thing to go wrong at initial setup but it also means
that it can cope with moving premises AND setting up a second location
in a single place.
It also means that if you think 'objects' you can emit objectively (as
it were) rather than HTML-ing every instance.
This gets more serious when you want to mix and mingle with CSS. An
'Address' object might be used for printing postal address to a screen,
a postcode to a map URL or a company address for an invoice (using DX
for solicitors etc.).
And if you're ever thinking of internationalisation ...
--
PETER FOX Not the same since the statuette business went bust
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>