Jump to content

Using a class within another class


kickassamd

Recommended Posts

I cant get this to work.... (I can extend the class from the other....but why...shouldnt have to)

Class 1 is the Smarty() Template Engine
Class 2 is my system class for redirecting users, processing user logins...etc etc.

Thing is im trying to use the smarty class within my system for this

public function redirect_header($url,$time,$message)
{
// Set Smarty Variables
Smarty::assign('redirect_url',$url);
Smarty::assign('redirect_time',$time);
Smarty::assign('redirect_notice',$message);
// Display Redirect Page...
Smarty::display('redirect_page.tpl');
}

it works just fine...until i use the display function then i get this error

Fatal error: Call to undefined method core_system_factory::fetch() in c:\Inetpub\wwwroot\classes\smarty\Smarty.class.php on line 1108.

I dont understand why it doesnt work.... fetch() is a smarty function not mine...so why is it looking in my class for it....

So my true question is how can i use a class function from another class within a class... with extending my system class from Smarty....
Link to comment
https://forums.phpfreaks.com/topic/11955-using-a-class-within-another-class/
Share on other sites

[!--quoteo(post=383664:date=Jun 14 2006, 02:52 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 14 2006, 02:52 AM) [snapback]383664[/snapback][/div][div class=\'quotemain\'][!--quotec--]
the Smarty object refers to it and you have called the Smarty object. check what's going on on line 1108 in the smarty class file
[/quote]


Smarty works just fine...just not when im trying to use it within another class...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.