|
Posted by Willem Bogaerts on 03/06/07 09:52
> - Because I'm using MySQL 4.1 and MyISAM tables (InnoDB is too darn
> big), I have to manage all the relationships myself.
I run PHP and MySQL myself on an ancient home computer with win98 and
far too little disk space. It runs fine. With InnoDB, that is.
<snip>
> - Compiled (or pseudo-compiled) languages such as Java and .NET can pull
> in called objects as needed. PHP doesn't. All that code is read and
> parsed for every page that requires any of it.
>
> I can't see that this approach is very efficient for PHP, but I don't
> want to continue the "data access code is sprinkled everywhere"
> approach. Unfortunately, the web host does not support PHP 5.
Why not? PHP is an interpreter language. Loading things only when you
need them is quite efficient. If you use the require_once statement, you
can make sure that you don't define things twice with includes.
Be careful though, that PHP first tries to resolve relative paths
relative to the "browsed" file, not to the currently included file. Best
to use absolute paths only. So instead of:
require_once('../database.php');
you could write:
require_once(dirname(__FILE__) . '/../database.php');
There is no difference when you point your browser to that file, but
there is a difference when you include a file with the above contents
from another directory.
Best regards
--
Willem Bogaerts
Application smith
Kratz B.V.
http://www.kratz.nl/
[Back to original message]
|