Jerry Stuckle wrote:
That's where we differ. I don't use optional classes. But that's not
to say there is anything wrong with your way - it's perfectly fine. Just
my personal preference.
Nor do I usually.
But for my Blog/CMS, I like to be able to take advantage of third-party
libraries that might be installed on the server, but without making my
code completely dependent on them. So the code checks to see if they're
available, and if so uses them. If not, then perhaps you miss out on a
cute little feature, but it's no big deal.
Another way to do this is to have some configuration file somewhere with:
$blah_module_is_installed = FALSE;
and later:
if ($blah_module_is_installed)
{
include "blah.php";
blah();
}
but this requires the site administrator to manually enable the blah
extension. Perhaps I have been using Macs too much, but I think that
"detect if cool feature X is available, and if so use it without a fuss"
is a good philosophy.
Of course, there are some PEAR libraries that my CMS absolutely requires,
and in those cases it would of course allow for the error to be raised
when the included file is not found!
--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 3 days, 23:42.]
Sharing Music with Apple iTunes
http://tobyinkster.co.uk/blog/2007/1...tunes-sharing/