doddsey_65 Posted May 19, 2011 Share Posted May 19, 2011 im trying to initialize a class within another class but it says the class cant be found: class template { public function create_sidebar($type) { include($config['asf_root'].'functions/forum_functions.php'); $forum_tree = new forum_display; } } and the forum_display class does exist in the included file: class forum_display { public $forums = array(); function get_forum_listing() Link to comment https://forums.phpfreaks.com/topic/236827-class-within-a-class/ Share on other sites More sharing options...
anupamsaha Posted May 19, 2011 Share Posted May 19, 2011 I would suggest you to check couple of things. 1. If $config['asf_root'] has a training slash (/)? 2. If forum_functions.php has the read permission? Link to comment https://forums.phpfreaks.com/topic/236827-class-within-a-class/#findComment-1217386 Share on other sites More sharing options...
trq Posted May 19, 2011 Share Posted May 19, 2011 You really should look into using an autoloader. Having include statements throughout your code will be a nightmare if you ever need to move things around. Link to comment https://forums.phpfreaks.com/topic/236827-class-within-a-class/#findComment-1217418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.