same logic should apply to many files as one file....
in one file, if there is a non-atomic bit of code you use more than once, you make a function out of it.. ok well
for organizing multi page libraries, if there is a bit of common code you need to use on more than one page... then wrap it in a function and put it in a library....
or if you are comfortable with static syntax wrap up the function in a class and call it statically, using the class as a namespace like in c
this way you can have two functions named the same and include both libraries...
Lib::fun1();
Lib2::fun1();
class Lib
{
function fun1() { echo 'foo'; }
}
class Lib2
{
function fun1() { echo 'bar'; }
}
edit your php.ini file to point to one common library directory... so you can directy include the file
include_path = "./:/www/htdocs:/www/pear:/www/common_php_library"
and then simply include libraries like this
require_once 'lib1.php';
require_once 'lib2.php';
if you can use the auto_prepend_file directive in you php.ini to auto load a file, which should simply load your common libraries
auto_prepend_file = path/to/autoload.php
<?php
#autoload.php
require_once 'path_to_lib1.php';
require_once 'path_to_lib2.php';
?>
if you do not have controll over your php.ini or you share one common php instance across multiple sites
you can use this trick:
<?php
#COMMON.PHP
$include_path = ini_get( 'include_path' );
$include_path .= ":/www/htdocs:/www/pear:/www/common_php_library";
ini_set( 'include_path', $include_path );
?>
and now each file must be responsible for requiring directly common.php
require_once '../../../common.php'
but after that you have your path set so you can include a library like this
require_once 'html_library.php'
require_once 'cc_library.php'
perhaps this helps you think about how you can go about organizing your libarary