12-17-2008, 08:43 PM
|
#1 (permalink)
|
|
The Visitor
Join Date: Dec 2008
Posts: 2
Thanks: 1
|
application-wide object
quick question -- i have a couple of core classes that "run" my application that i'd love to have persist over the entire application so that i can easily use it throughout the application without having to include and instantiate the class on every one of my controllers...
so, right now i have this:
Code:
// start the session
session_start();
// only instantiate the core class once per session
if(!isset($_SESSION['site_core'])){
$_SESSION["careers_core"] = new careersCore('site.com');
}
then, throughout my application, i can reference it by doing this:
Code:
$_SESSION['site_core']->do_something();
this seems...i dunno...bad. any advice for how to accomplish better what i am doing?
thanks everyone!
robocop
|
|
|
|