Class with variables accessible to other classes - PEAR::getStaticProperty() ?

From: Date: Mon, 08 Mar 2004 22:49:20 +0000
Subject: Class with variables accessible to other classes - PEAR::getStaticProperty() ?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-11168@lists.php.net to get a copy of this message
Hi everybody I'm creating a cms system and I need to make certain variables accessible to different classes. For instance I need to make different configuration parameters accessible to many different classes - these configuration parameters are loaded from a database and vary depending on which page is loaded - meaning there exists configuration parameters which are only valid/meaningful for certain pages! Furthermore I have som "page" variables which are variables to be used for the smarty engine but is to be manipulated from different classes! I thought of using something like: MyConfig::setValue($varName, $varValue); // to create a config variable $varName with value $varValue MyConfig::getValue($varName); // to fetch the value from the config variable $varName and of course something similar for the page variables! The problem is how I'm supposed to program the methods setValue and getValue in the MyConfig class? I think I might need PEAR::getStaticProperty() for this purpose - Am I right or just entirely wrong? If you have any suggestions or ideas please share them - also if it means completely wrecking my suggestion above - it might be stupid and an ingenious solution could be lurking just around the corner :-) TIA, Cheers, Tommy Ipsen

« previous php.pear.general (#11168) next »