![]() |
Registry pattern
Heard about it? Used it? I've already implemented it and it's a life saver. ^^ I bet there are many more interesting patterns to follow, but I really needed this one, so I could stop passing an object over and over again through the constructors and such and I didn't even know it exists :P
My implementation: PHP Code:
|
Oh, come on...nobody uses it? Here's an example of how easy your life becomes:
index.php: Code:
$database = new Database();Code:
require 'registry.php'; |
I haven't yet, but I was considering the Registry method for configuration and loading specific settings. Wordware's book on design patterns is my next book; I've been reading about OOA&D this past week or two, and letting that sink in first.
|
yea i've used it before, i used it for a simple mvc based site i did not long ago, pretty good
|
Xenon thank you for this post it is a great example and exactly what I was trying to understand. You provided the usage of Registry within another class and I needed to see a practical example!
Cheers |
I am new here...is your post regarding my cry for help with sql comma problem? If so...that sql is way over my head!
|
Stay on topic vpopp. People will respond to your sql thread if they have a solution. This is not the place to talk about that.
|
I use this method all the time i am working on a site right now using something like this. I think its good.
|
| All times are GMT. The time now is 07:31 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0