View Single Post
Old 01-06-2009, 01:46 AM   #6 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

How about using like the following to achieve what you're after? All you have to do is ensure the TalkPHP_Factory is included on every single page, and then make your calls as so:

php Code:
echo TalkPHP_Factory::getInstance()->TalkPHP_Hello()->getText();
echo TalkPHP_Factory::getInstance()->TalkPHP_Goodbye()->getText();

This is in the style Class->Function(). Is this something like what you're after?

Obviously you'll need to modify it a touch to auto include files, but I added the functionality in the __autoload() function, just to show you how you could do it.

php Code:
function __autoload($szClass)
{
    $szFile = sprintf('./includes/%s.php', $szClass);
   
    if (!file_exists($szFile))
    {
        return false;
    }
   
    include_once($szFile);
}
Attached Files
File Type: php TalkPHP_Factory.php (943 Bytes, 122 views)
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
Scottymeuk (01-06-2009)