/** * テンプレート用のプレビュー */ private function preview_template() { $request = Request::getInstance(); $blog_id = $this->getBlogId(); // 記事一覧データ設定 $options = array('where' => 'blog_id=?', 'params' => array($this->getBlogId())); $pages = $request->get('page') ? array() : array('index_area'); $this->setEntriesData($options, $pages); // テンプレートのプレビュー $html = $css = null; if ($request->get('template_id')) { $blog_template = Model::load('BlogTemplates')->findByIdAndBlogId($request->get('template_id'), $blog_id); $html = $blog_template['html']; $css = $blog_template['css']; } else { $html = $request->get('blog_template.html'); $css = $request->get('blog_template.css'); } // テンプレートのシンタックスチェック Model::load('BlogTemplates'); $syntax = BlogTemplatesModel::fc2TemplateSyntax($html); if ($syntax !== true) { return 'Entries/syntax.html'; } // FC2用のテンプレートで表示 $device_type = $this->getDeviceType(); $preview_path = BlogTemplatesModel::getTemplateFilePath($blog_id, $device_type, $html); is_file($preview_path) && unlink($preview_path); return $this->fc2template($blog_id, $html, $css); }