Destramic Posted August 10, 2011 Share Posted August 10, 2011 hey guys...is there a way of getting the name of that class that the extended class was called from...ie. <?php class News_Controller etends Actions { } class Actions { public function model_name() { $model_name // = class name news_controller } } ?>[code] [/code] Quote Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/ Share on other sites More sharing options...
Destramic Posted August 10, 2011 Author Share Posted August 10, 2011 echo get_class($this); did the trick...but how can i call a method if the class is an extended class Quote Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/#findComment-1255599 Share on other sites More sharing options...
The Little Guy Posted August 10, 2011 Share Posted August 10, 2011 What do you mean? I assume you mean like this: //Within the class: $this->model_name(); //Outside the class: $class = new News_Controller(); $class->model_name(); Quote Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/#findComment-1255600 Share on other sites More sharing options...
Destramic Posted August 10, 2011 Author Share Posted August 10, 2011 well i suppose i could do it in a constuctor Quote Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/#findComment-1255602 Share on other sites More sharing options...
The Little Guy Posted August 10, 2011 Share Posted August 10, 2011 ?? can you re-word this: how can i call a method if the class is an extended class I don't understand what you mean. Quote Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/#findComment-1255604 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.