Раньше был такой код все хранились в одном месте.
Код |
if(!empty($_POST['comand'])){ $comand = $_POST['comand']; switch($comand){
case 'initForum': include_once getTemplateCore('actions/forum_group_list.php'); break;
case 'initForum2': include_once getTemplateCore('actions/forum_group_list2.php'); break;
... итд.
}}
|
Все это дело разбили не модули. В данный момент работает так Читается папка с модулями подрубается файл с такой структурой
Код |
if(!empty($_POST['comand'])){ $comand = $_POST['comand']; }else $comand '';
$dir = core_root.'/moduls/';
$handle = opendir($dir); $i= 0; while (false!==($file = readdir($handle))): if(($file != ".") && ($file != "..")) if(is_file($dir.$file.'/include_ajax_comand.php')){ include_once($dir.$file.'/include_ajax_comand.php'); } endwhile; closedir($handle);
|
Файл include_ajax_comand.php
Код |
switch($comand){
case 'initForum2': include_once getTemplateCore('actions/forum_group_list2.php'); //Шаблон. break;
... итд. }
|
Вроде все норм работает но хочется по красивее вариант кто подскажет ?
|