Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Файл: template.class.php
- Роль файла: Парсинг шаблонов
- */
- class template
- {
- public function load_template($tpl, $replace=false)
- {
- $tpl = TPL_DIR . $tpl;
- if(!file_exists($tpl))
- {
- $_SESSION['engine_error'][] = "Невозможно прочитать файл шаблона: <b>" . $tpl . "</b>";
- $result = false;
- }
- else
- {
- $result = file_get_contents($tpl);
- if(is_array($replace) == true)
- {
- $result = strtr($result, $replace);
- }
- }
- return $result;
- }
- public function load_usermodul($mod_name)
- {
- $dir = SYS_DIR . 'user_modules/' . $mod_name . '.php';
- if(!file_exists($dir))
- {
- $result = "Модуль <b>" . $mod_name . "</b> не найден";
- }
- else
- {
- require $dir;
- $obj = new $mod_name;
- $result = $obj->user_modul();
- }
- return $result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment