BcBaserHelper::page PHP Method

page() public method

※ レイアウトは読み込まずコンテンツ本体のみを読み込む
public page ( string $url, array $params = [], array $options = [] ) : void
$url string 固定ページのURL
$params array 固定ページに引き継ぐパラメータ(初期値 : array())
$options array オプション(初期値 : array()) - `loadHelpers` : ヘルパーを読み込むかどうか(初期値 : false) todo loadHelpersが利用されていないのをなんとかする - `subDir` : テンプレートの配置場所についてプレフィックスに応じたサブフォルダを利用するかどうか(初期値 : true) - `recursive` : 固定ページ読み込みを再帰的に読み込むかどうか(初期値 : true)
return void
    public function page($url, $params = array(), $options = array())
    {
        if (isset($this->_View->viewVars['pageRecursive']) && !$this->_View->viewVars['pageRecursive']) {
            return;
        }
        $options = array_merge(array('loadHelpers' => false, 'subDir' => true, 'recursive' => true), $options);
        $subDir = $options['subDir'];
        $recursive = $options['recursive'];
        $this->_View->viewVars['pageRecursive'] = $recursive;
        // 現在のページの情報を退避
        $editLink = null;
        $description = $this->getDescription();
        $title = $this->getContentsTitle();
        if (!empty($this->_View->viewVars['editLink'])) {
            $editLink = $this->_View->viewVars['editLink'];
        }
        // urlを取得
        if (empty($this->_View->subDir)) {
            $url = '/../Pages' . $url;
        } else {
            $dirArr = explode('/', $this->_View->subDir);
            $url = str_repeat('/..', count($dirArr)) . '/../Pages' . $url;
        }
        $this->element($url, $params, array('subDir' => $subDir));
        // 現在のページの情報に戻す
        $this->setDescription($description);
        $this->setTitle($title);
        if ($editLink) {
            $this->_View->viewVars['editLink'] = $editLink;
        }
    }