Jump to content

[SOLVED] Where do you place class libraries?


sennetta

Recommended Posts

I have a site which has one point of access for the end user: the "index.php" in the public_html dir.  Other pages are included by reference in this page: "index.php?p=news"

 

My question is should I place these included pages in a web accessible dir (below public_html), or should I place them above?  Also where should I put any class files I use?  If I put them above the public_html dir will it cause any problems?

 

Cheers,

 

Anthony

Also where should I put any class files I use?

 

I do this:

<?php
// LIB_PATH being defined to hold the path to the library folder
function __autoload($class)
{
$path = LIB_PATH . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
if(file_exists($path))
{
	require $path;
}
}
?>

 

In that way I don't have to include any class files. Database would be in /path/to/lib/Database.php, Database_MySQL would be in /path/to/lib/Database/MySQL.php etc.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.