So you script loads all database objects regardless of what it being used????
I think that a bit ineffective!!! Specially if you have all sorts of different pog classes
It’s better to use php5 autoload function in order to load class objects whenever they are needed.
Can’t do that with include files thought (that contain functions not classes), so you will have to include those like you are doing
Here is my autoloader function I am using for POG. I just include the file that contains this code in confuration.php and any php file that needs a pog class it loaded automatically.
// automatially load objects in objects folder
function __autoload($class_name)
{
global $config;
$path = $config['root-path'].'objects/class.'.strtolower($class_name).'.php';
if(file_exists($path)){
require_once $path;
return;
}
}
Note that $config['root-path'] is something I am using which stores the absolute path of my script
Here is the code for it as well since I made it to find that automatically so I don’t have to find the path each time
function root_path() {
$base_path = dirname(__FILE__);
if(!preg_match("/(\/)$/", $base_path)) $base_path = $base_path . '/';
$base_path = str_replace("/includes/", "/", $base_path);
$base_path = str_replace("\includes", "", $base_path);
return $base_path;
}
$config['root-path'] = root_path();
Again note that this function is inside an includes folder that is why I replace that from the path I am getting
Kindest Regards,
Paris Paraskeva
Managing Director
M.E. & E. United Worx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
The information contained in this email message(and any attachments) is legally privileged and confidential information intended only for the use of the addressee(s) listed on this email. If the reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution or copy of this email is strictly prohibited. If you have received this email in error, please notify us by telephone or email on the contact details shown on the end of this email. Thank you.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 4531 (20091022) __________
The message was checked by ESET NOD32 Antivirus.