■ユーザーズフォーラム リニューアルのお知らせ
新規投稿は新ユーザーズフォーラムにお願いします。

ページをエレメントとして読み込む

Rightray > ページをエレメントとして読み込む @ 2014/1/21 18:11
バージョン2では固定ページ編集で
<?php $bcBaser-> page(16) ?>
を埋め込んで別の固定ページを表示できていましたが、バージョン3ではエラーが出てしまいます。
コードは
<?php $this->BcBaser-> page(16) ?>
です。
表示されるエラーは

Notice (1024): Element Not Found: /.Elements/./Pages16.php [CORE/Cake/View/View.php, line 413]
Code Context
            $name = str_replace('/', DS, $name);
            $file = $plugin . 'Elements' . DS . $name . $this->ext;
            trigger_error(__d('cake_dev', 'Element Not Found: %s', $file), E_USER_NOTICE);
$name = './Pages16'
$data = array()
$options = array(
'subDir' => true,
'callbacks' => false
)
$file = '/.Elements/./Pages16.php'
$plugin = '/.'
View::element() - CORE/Cake/View/View.php, line 413
BcBaserHelper::getElement() - CORE/Baser/View/Helper/BcBaserHelper.php, line 589
BcBaserHelper::element() - CORE/Baser/View/Helper/BcBaserHelper.php, line 629
BcBaserHelper::page() - CORE/Baser/View/Helper/BcBaserHelper.php, line 1804
include - APP/webroot/theme/nada-icons/Pages/index.php, line 20
View::_evaluate() - CORE/Cake/View/View.php, line 929
BcAppView::evaluate() - CORE/Baser/View/BcAppView.php, line 417
BcPageHelper::content() - CORE/Baser/View/Helper/BcPageHelper.php, line 322
include - CORE/Baser/View/Pages/templates/default.php, line 21
View::_evaluate() - CORE/Cake/View/View.php, line 929
View::_render() - CORE/Cake/View/View.php, line 891
View::render() - CORE/Cake/View/View.php, line 460
Controller::render() - CORE/Cake/Controller/Controller.php, line 952
PagesController::display() - CORE/Baser/Controller/PagesController.php, line 634
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 490
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 185

何かインストールで失敗しているのでしょうか?

よろしくお願いします。

■ バージョン:3.0.2
■ サーバー名:サクラ スタンダード
■ スマートURL:ON
■ 設置フォルダ:ドキュメントルート
■ データベース:SQLite
■ PHPスキル:[ D ]

tecking > Re: ページをエレメントとして読み込む @ 2014/1/23 0:46
Rightrayさん

バージョン2の $bcBaser->page と、バージョン3の $this->BcBaser->page のソースを見てみたところ、前者は引数がページID、後者の引数はページ名という違いがあるようですね。

仮に、Rightrayさんが挙げていらっしゃる ID 16 のページ名が foo だとした場合、下記のようなコードを試されてはいかがでしょうか。
(3.0.1+『nada icons』テーマで検証しました)

<?php $this->BcBaser->page('/foo') ?>


バージョンアップに伴って引数が変わったので、関数リファレンスへの追記が必要かもしれませんね。
Rightray > Re: ページをエレメントとして読み込む @ 2014/1/23 8:06
無事表示できました!

ページ名も試しては見たんです。スラッシュが必要だったのですね。


teckingさん ありがとうございました。

■ バージョン:3.0.2
■ サーバー名:サクラ スタンダード
■ スマートURL:ON
■ 設置フォルダ:ドキュメントルート
■ データベース:SQLite
■ PHPスキル:[ D ]

ログイン
ユーザー名:
パスワード:


  新規登録 / パスワード紛失

検索

facebook
フォーラムで悩みが解決した場合など、よかったら「いいね!」をポチっとクリックしてください!質問の回答者や開発者の励みになります

フォーラムガイド


関連リンク

オンライン状況
12 人のユーザが現在オンラインです。 (11 人のユーザが フォーラム を参照しています。)

登録ユーザ: 0
ゲスト: 12