سلام خسته نباشید بهترین راه رو برای ارسال مقادیر جهت اجرای منو داینامیک در هدردر فریمورک ما چیست
من با این روش به خواستم رسیدم اگه راه بهتری پیشنهاد دارید ممنون میشم بفرماییدداخل helper view
function view($path, $data = [], $layout = null) { $path = str_replace('.', DIRECTORY_SEPARATOR, $path); $path_explode = explode('/', $path); $full_path = BASEPATH . "views/$path.php"; $is_file = is_readable($full_path) && file_exists($full_path); if ($path_explode[0] == 'frontend') { $data = inject_menu($path_explode[0]); } if (is_null($layout)) { $is_file ? buffering($full_path, $data, $path_explode[0]) : include_once BASEPATH . "views/error/404.php"; } $is_file ? buffering($full_path, $data) : include_once BASEPATH . "views/error/404.php"; } function inject_menu($path) { $categoryModel = new Category; $categoryLevelOne = $categoryModel->get('*', ['parent_id' => 0]); foreach ($categoryLevelOne as $LevelOne) { $categoryLevelTwo[$LevelOne['id']] = $categoryModel->inner_join('photos', 'id', 'entity_id', 'categories.parent_id' . '=' . $LevelOne['id']); } return [ 'categoryLevelOne' => $categoryLevelOne, 'categoryLevelTwo' => $categoryLevelTwo ]; } function buffering($full_path_view, $data, $dir = null) { if (!is_null($dir)) { ob_start(); extract($data); include_once $full_path_view; $view = ob_get_clean(); include_once BASEPATH . "views/$dir/layouts/master.php"; } include_once $full_path_view; }