Пример #1
0
 private static function generateTypeBlockTemplates($typeName, $tags)
 {
     if (!is_dir(APP_PATH . '/typebloks/templates')) {
         throw new Exception('Templates directory for new typeblock not exists: ' . $typeName);
     }
     mkdir(APP_PATH . '/typebloks/templates/' . $typeName, 0766);
     $render = new K_TemplateRender(null, null, $left = '<%', $right = '%>');
     $render->setTags($tags);
     $render->fromFile(APP_PATH . '/admin/phptemplates/typeblock/item.ptpl');
     $code = $render->assemble();
     $f = @fopen(APP_PATH . '/typebloks/templates/' . $typeName . '/item.php', 'w');
     fwrite($f, $code);
     fclose($f);
     $render->fromFile(APP_PATH . '/admin/phptemplates/typeblock/list.ptpl');
     $code = $render->assemble();
     $f = @fopen(APP_PATH . '/typebloks/templates/' . $typeName . '/list.php', 'w');
     fwrite($f, $code);
     fclose($f);
 }