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] 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 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(); 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 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. Link to comment https://forums.phpfreaks.com/topic/244454-oop-question/#findComment-1255604 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.