PagesController::_createPreviewTemplate PHP Method

_createPreviewTemplate() protected method

プレビュー用テンプレートを生成する
protected _createPreviewTemplate ( $data ) : string
return string uuid
    protected function _createPreviewTemplate($data)
    {
        // 一時ファイルとしてビューを保存
        // タグ中にPHPタグが入る為、ファイルに保存する必要がある
        $contents = $this->Page->addBaserPageTag(null, $data['Page']['contents_tmp'], $data['Content']['title'], $data['Content']['description'], $data['Page']['code']);
        $uuid = CakeText::uuid();
        $path = TMP . 'pages_preview_' . $uuid . $this->ext;
        $file = new File($path);
        $file->open('w');
        $file->append($contents);
        $file->close();
        unset($file);
        @chmod($path, 0666);
        return $uuid;
    }