Re: Class not functioning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allen McCabe wrote:
> Hey all (and Nirmalya, thanks for the help!),
> 
> 
> I have a question that I just can't seem to find via Google.
> 
> I want to be able to add messages to a qeue whenever my classes complete (or
> fail to complete) specific functions. I think have a call within my html to
> my Notifier class to print all qeued messages (via a function 'printQ').
> 
> How do I access a globally instantiated class from within another class?
> 
> Example:
> 
> <?php
> 
> // INSTANTIATE
> $Meetgreet = new Meetgreet;
> $Notify = new Notifier;
> 
> ...
> ...
> 
> $Meetgreet->deleteSingle($id, 1); // This completes a function within
> Meetgreet class. That function needs to be able to use the Notifier function
> addtoQ(), how would this be accomplished?
> 
> ?>
> ...
> ...
> 

Several ways to do it.  One would be to make the Meetgreet a singleton
if it really is, and then use its static getInstance.  I would probably
use a registry pattern though.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux