Altec Posted September 22, 2009 Share Posted September 22, 2009 I'm attempting some form of expandable/modular administration panel for my site. I finally got the code nailed down after a few tries. I go to load the page and: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33292286 bytes) in index.php on line 53 I have never run across this before. My code to build the menu (of which is causing this error) is: $menu = (string) null; $modules_dir = ADMIN_ROOT.'modules'; $dir = opendir($modules_dir); while( ( $module = readdir($dir) ) !== false ) { if( is_dir($modules_dir.'/'.$module) && !in_array($module,array('.','..')) && file_exists($modules_dir.'/'.$module.'/module_meta.php') ) { include($modules_dir.'/'.$module.'/'.'module_meta.php'); $meta_function = $module.'_meta'; $menu_init = $meta_function(); $count = count($menu_init) - 1; $menu .= '<h2>'.$menu_init[0].'</h2><ul>'; for($i = 1; $i != $count; $i++) { $menu .= '<li><a href="'.$menu_init[$i]['link'].'">'.$menu_init[$i]['title'].'</a></li>'; } $menu .= '</ul>'; } } closedir($dir); echo output_page(ADMIN_ROOT.'inc/template.html',array('{MENU}'),array($menu)); Line 53 is the one line inside the for() loop. An example *_meta() function is: function quicklinks_meta() { $menu_items = array( 'Quick Links', array('id' => 'home','title' => 'ACP Home','link' => 'index.php?module=home'), array('id' => 'newpost','title' => 'New Blog Post','link' => 'index.php?module=newpost'), array('id' => 'newpage','title' => 'New Page','link' => 'index.php?module=newpage') ); } Anyone? Quote Link to comment Share on other sites More sharing options...
Altec Posted September 22, 2009 Author Share Posted September 22, 2009 lmfao, I forgot to return the $menu_items array. /facepalm Quote Link to comment 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.