これは私のコントローラーです:
class HomeController extends BaseController {
public $layout = 'default';
public function index()
{
$page = Page::find(1);
$this->layout->page_title = $page->page_title;
$allPages = Page::lists('title');
// Give the page it's needed content
$this->layout->nest('content', 'pages.home', array(
'pageHeading' => 'Rendered with Mustache.php',
'pageContent' => $allPages
));
}
}
というマスター テンプレートdefault.blade.php
と という子ページ テンプレートがありhome.mustashe
ます。
home.mustache
問題は、テンプレート内のすべてのページ タイトルを含む配列を使用したいということです。home.mustache
配列をテンプレートに追加するにはどうすればよいですか?
現在のコードでは、次のエラーが発生します。Array to string conversion
私が使用する口ひげパッケージは次のとおりです。口ひげパッケージへのリンク