【发布时间】:2013-10-16 15:33:00
【问题描述】:
这是我的控制器:
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
我使用的 Mustache 包是:Link to mustache package
【问题讨论】:
标签: php laravel laravel-4 mustache.php