Website Structure Problems

From: Date: Mon, 21 Apr 2003 11:21:39 +0000
Subject: Website Structure Problems
Groups: php.general 
Request: Send a blank email to php-general+get-144624@lists.php.net to get a copy of this message
I am trying to come up with a good basic structure for my website. I am currently using objects as containers of functions and variables, but I am sure there is a better way to do what I want to do. I am using Smarty to handle my output, and a user class to handle all login/logout session work. My basic structure is currently something like this: $cfg = array("user"=>"myuser", "pass"=>"mypass"); //etc $smarty = new Smarty($cfg); $db = new database($cfg, $smarty); $login = new login($cfg, $smarty, $db); Each of the classes needs to access the global variable $cfg to read configuration information. In addition, each of my classes are dependent on all the others, however, which means that as I add features, the parameter lists keep expanding. In the class constructors, I store local references to the global variables or objects passed as parameters. There _must_ be a better way of making classes that can interface with each other and with the config variable. I could have each class inherit functions from the other, but this is bad coding practice (I guess that using objects merely as function containers is bad practice too). Is there some generally 'preferred' method of handling my problem or of generally structuring a site? I think I need a major restructuring of the whole site. :( Joachim

« previous php.general (#144624) next »