Search found 8 matches

by ird
Thu Mar 20, 2008 12:20 am
Forum: Coding Critique
Topic: Communicating Between Classes
Replies: 7
Views: 3374

Re: Communicating Between Classes

<pre> <?php require_once('tiff_func.php');   class core {     private $objects = array();     private static $instance = NULL;       private function __construct()     {         //private construct     }     private function __clone()     {         //no cloning     }       function get_instance()  ...
by ird
Mon Mar 17, 2008 7:00 pm
Forum: Coding Critique
Topic: Communicating Between Classes
Replies: 7
Views: 3374

Re: Communicating Between Classes

Ah, thank you very much.

This is exactly the type of pattern I was looking for.

Also, thanks for introducing me to such a great PHP site.

:D
by ird
Mon Mar 17, 2008 12:39 am
Forum: Coding Critique
Topic: Communicating Between Classes
Replies: 7
Views: 3374

Re: Communicating Between Classes

I can't seem to find much on a 'registry' with google.

Where can I get more information on implementing one?
by ird
Thu Mar 13, 2008 11:10 pm
Forum: Coding Critique
Topic: Communicating Between Classes
Replies: 7
Views: 3374

Communicating Between Classes

Hi. I'm currently writing a small CMS (sort of) for personal use. I'm trying to write it with OOP but it's been nothing but headaches. I'm trying to do a few things and I can't find much info on how to do them. A) A global class that deals with the database (the connection, queries, etc) B) Another ...
by ird
Thu Mar 13, 2008 9:16 pm
Forum: PHP - Code
Topic: OO Singletons
Replies: 7
Views: 519

Re: OO Singletons

Oh, you mean like. mysql_real_escape_string().

So. If I don't use a singleton, is there another to make my script only allow ONE connection to the database.

I don't want to end up with 5 connections.
by ird
Thu Mar 13, 2008 9:33 am
Forum: PHP - Code
Topic: OO Singletons
Replies: 7
Views: 519

Re: OO Singletons

Mordred wrote:Also, be careful to whom you delegate escaping. In result_count for example, it should be the db object. Expose a db-specific method for escaping.
Could you elaborate? I'm not I understand what you mean.
by ird
Thu Mar 13, 2008 2:26 am
Forum: PHP - Code
Topic: OO Singletons
Replies: 7
Views: 519

Re: OO Singletons

That would require me to have a heart ;)
by ird
Thu Mar 13, 2008 12:55 am
Forum: PHP - Code
Topic: OO Singletons
Replies: 7
Views: 519

OO Singletons

<?php   function emptyEx() {     if (!(func_num_args() > 0))     {         return NULL;     }       $args = func_get_args();         foreach ($args as $tmp)     {         if (empty($tmp))         {             return 1;         }     }     return 0; }   class database {     private static $db_handl...