示例#1
0
 public function load($id, $path = null, $hash = null)
 {
     $this->template->load($id, 'Class', $path);
     if ($hash) {
         nc_tpl_parser::main2parts($this->template, $hash);
     }
 }
示例#2
0
 public function save_fields($fields, $template = null)
 {
     $template = $template ? $template : $this->template;
     foreach ($fields as $name => $value) {
         nc_save_file($template->fields->get_path($name), $value);
     }
     nc_tpl_parser::parts2main($template);
 }
示例#3
0
 public function save_fields($only_isset_post = false, $template = null, $fld_content = null)
 {
     if (null == $template) {
         $template = $this->template;
     }
     if ($fld_content === null) {
         $fld_content = nc_core('input')->fetch_post();
     }
     foreach ($template->fields->standart as $field => $tmp) {
         if (!$only_isset_post || isset($fld_content[$field])) {
             if ($field == 'RecordTemplate') {
                 $fld_content['RecordTemplate'] = nc_get_string_service_prefix_for_RecordTemplate() . $fld_content['RecordTemplate'] . nc_get_string_service_suffix_for_RecordTemplate();
             }
             nc_save_file($template->fields->get_path($field), $fld_content[$field]);
         }
     }
     nc_tpl_parser::parts2main($template);
 }
示例#4
0
 public function load_template($id, $relative_path = null, $is_preview = false)
 {
     $this->template->load($id, 'Template', $relative_path);
     $this->is_preview = $is_preview;
     $core_template = nc_Core::get_object()->template;
     $all_id = explode('/', trim($this->template->relative_path, '/'));
     $this->root_template_id = current($all_id);
     foreach ($all_id as $id) {
         if (!+$id) {
             continue;
         }
         $hash = $core_template->get_by_id($id, 'File_Hash');
         if ($hash) {
             $template = new nc_tpl($this->template->path_to_root_folder, $this->template->db);
             $template->load($id, 'Template', $core_template->get_by_id($id, 'File_Path'));
             nc_tpl_parser::main2parts($template, $hash);
         }
     }
 }