0
私はPhalcon程度ビューとコントローラの詳細にドキュメントの問題の欠如に苦しんで、私はindex.phpの中でやっている特定のビューをレンダリングするときにレイアウトボルトを挿入するにはどうすればよいですか?
が似ている、私のコントローラで
$viewCollections = new MicroCollection() ;
$viewCollections->setHandler('BackenduiController',true) ;
$viewCollections->get('/main/index', 'index');
$app->mount($viewCollections) ;
、
<?php
use Phalcon\Mvc\View;
class BackenduiController extends ControllerBase
{
public function initialize()
{
}
public function index()
{
$this->tag->setTitle('A | B');
$this->view->setTemplateAfter('nav') ;
$this->view->render(
"main","index"
);
}
}
よ
マイビューボルトのファイル構造が似ている、
ビュー
--layouts
----index.volt
----nav.volt
--main
----index.volt
--index.volt
nav.voltはHTMLコードのナビゲーションバー部分ですが、私の目的はmain/indexページにナビゲーションバーコードを挿入することですが、setTemplateAfterを使用すると結果ページはコード、インデックスページをまったく表示しません。コントローラを正しいページにレンダリングさせるために、コードをどのように整理すればよいですか?
を行う必要がありますする必要がありますindex.voltで、あなたの 'nav.volt'テンプレートにビューの内容をロードしている
場所。 '{{content}}'を使って? – Timothy
@Timothy、ありがとう、はい、nav.voltの中に、{{content()}}があります。 –