处理某人的代码,弄清楚其中的内容,等等。 我得到的错误: 查看未找到[注册]。 (查看:/Users/striker/bankproject/app/views/frontend/default/pages/profile.blade.php)
我看到$ sections正从控制器传递到视图。
这是路线 路线::得到('寄存器' ['如' =>' register.create''使用' =>&# 39; UsersController @创建']); 路线::交('寄存器' ['如' =>' register.store''使用' =>&# 39; UsersController @商店']);
这是控制器
use Forret\Interfaces\UserInterface;
use View;
use Sentry;
class UsersController extends BaseController{
public function __construct(UserInterface $user){
$this->user = $user;
}
public function show($user_id){
$view['title'] = 'Forret - Profile';
$view['auth_navbar'] = 1;
$view['user'] = Sentry::getUser();
$view['sections'] = ["Frontend::components.sections.profile"];
return View::make('Frontend::pages.profile',$view);
}
public function create(){
$view['title'] = 'Forret - Register';
$view['auth_navbar'] = 0;
$view['user'] = [];
$view['sections'] = ['register'];
return View::make('Frontend::pages.profile',$view);
}
}
这是视图profile.php
@extends('Frontend::layouts.default')
@section('page_styles')
@stop
@section('content')
@foreach($sections as $section)
@include($section)
@endforeach
@stop
@section('page_scripts')
@stop
这是视图register.php
@extends('Frontend::layouts.default')
@section('page_styles')
@stop
@section('content')
@foreach($sections as $section)
@include("Frontend::components.sections.$section")
@endforeach
@stop
@section('page_scripts')
@stop
答案 0 :(得分:0)
将配置文件模板中的@include更改为:
@include("Frontend::components.sections.$section")