TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 12-17-2008, 08:43 PM   #1 (permalink)
The Visitor
 
robocop's Avatar
 
Join Date: Dec 2008
Posts: 2
Thanks: 1
robocop is on a distinguished road
Help 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
robocop is offline  
Reply With Quote
 



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the Clone Construct to Clone an Object Wildhoney Advanced PHP Programming 5 01-29-2013 11:51 AM
Using the factory pattern (mad rantings of a mind without coffee) sketchMedia Advanced PHP Programming 35 09-25-2009 11:05 AM
How to access the method of an object that is inside an object tony Advanced PHP Programming 5 11-13-2008 02:46 AM
Object Aggregation Jenski Advanced PHP Programming 2 08-07-2008 09:53 AM
Object methods suddenly lagging? RobertK Advanced PHP Programming 9 01-11-2008 01:38 PM


All times are GMT. The time now is 09:03 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design