compile_dir = "./compiled/"; $tpl->template_dir = "./templates/"; $tpl = new Template_Lite; $tpl->force_compile = true; $tpl->compile_check = true; $tpl->cache = false; $tpl->cache_lifetime = 3600; $tpl->config_overwrite = false; $kodzik = show_menu2(); $tpl->assign("kod_menu",$kodzik); if (isset($_GET['id']) && file_exists("./templates/".$_GET['id'].".tpl")) { // w przypadku kiedy dział ma poprawną nazwe i plik istnieje //$tpl->assign("main_part",$_GET['id'].".tpl"); $file=fopen("./templates/".$_GET['id'].".tpl", "r"); $content = stripslashes(fread($file, $maxLength)); fclose($file); $tpl->assign("main_part",$content); } else if (isset($_GET['path'])) { // wyswietlanie listy dostepnych modulow $modules[0]['label']=""; $modules = show_modules($_GET['path'], 1); $tpl->assign("modules",$modules); // nazwa modelu $tpl->assign("module_name",$modules[0]['label']); // wyswietlenie opisu pierwszego modulu if(file_exists("./files".$modules[0]['link']."/description.tpl")) { //$tpl->assign("link","../files".$modules[0]['link']."/description.tpl"); $file_with_desc = "./files".$modules[0]['link']."/description.tpl"; }else { //$tpl->assign("link","./no_desc.tpl"); $file_with_desc = "./templates/no_desc.tpl"; } $file=fopen($file_with_desc, "r"); $content = stripslashes(fread($file, $maxLength)); fclose($file); $tpl->assign("descr",$content); // galeria zdjec $thumbs = list_folder("./files".$modules[0]['link']); $tpl->assign("thumbs",$thumbs); $tpl->assign("path","./files".$modules[0]['link']."/"); $tpl->assign("main_tpl","./product.tpl"); } else if (isset($_GET['product'])) { // wyswietlanie listy dostepnych modulow $modules[0]['label']="test"; $modules = show_modules($_GET['product'], 2); $tpl->assign("modules",$modules); // nazwa modelu $tpl->assign("module_name",get_module_name($_GET['product'])); // wyswietlenie opisu pierwszego modulu //$tpl->assign("link","../files".$_GET['product']."/description.tpl"); if(file_exists("./files".$_GET['product']."/description.tpl")) { //$tpl->assign("link","../files".$modules[0]['link']."/description.tpl"); $file_with_desc = "./files".$_GET['product']."/description.tpl"; }else { //$tpl->assign("link","./no_desc.tpl"); $file_with_desc = "./templates/no_desc.tpl"; } $file=fopen($file_with_desc, "r"); $content = stripslashes(fread($file, $maxLength)); fclose($file); $tpl->assign("descr",$content); // galeria zdjec $thumbs = list_folder("./files".$_GET['product']); $tpl->assign("thumbs",$thumbs); $tpl->assign("path","./files".$_GET['product']."/"); $tpl->assign("main_tpl","./product.tpl"); } else { // w przypadku gdy nie ma działu lub z jakiego� powodu plik zosta� skasowany // rowniez w przypadku gdy otwieramy strone po rax pierwszy i laduje sie domyslny dzial //$tpl->assign("main_part","./main.tpl"); $file=fopen("./templates/main.tpl", "r"); $content = stripslashes(fread($file, $maxLength)); fclose($file); $tpl->assign("main_part",$content); } $tpl->display("index.tpl"); ?>