Utherr12 Posted March 25, 2011 Share Posted March 25, 2011 function _get_template_list() { if (empty($this->template_list)) { $dir = new DirectoryIterator(DOKU_INC.'tpl/'); $tpl_list = array(); foreach($dir as $file) { if($file->isDir() && !$file->isDot()) $tpl_list[] = $file; } $this->template_list = $tpl_list; } else return null; } I don't think the whole class matters. If I comment out the line where I call this method inside another method of the same class, the page works, otherwise I'm getting 500 Error.I just want to know if my method is my mistake or there's something more to it.DOKU_INC is a constant to a path, I've checked it and it's good. Link to comment Share on other sites More sharing options...
boen_robot Posted March 26, 2011 Share Posted March 26, 2011 Does DOKU_INC end with a "/"? If not, the whole string will lead to a non-existent path, therefore throwing an exception, therefore leading to the error.Also, notice that in both cases the function would return null, because after the loop, you aren't returning anything (therefore the default return value null). Is that what your outer layer expects, or should the templace list itself be returned? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.