Laravel에 페이지 시스템이 있습니다. 컨트롤러에서보기로 데이터를 전달합니다.
$this->data['title'] = $row->title;
$this->data['breadcrumb'] = $row->bc;
이제 다음과 같이 전달했습니다.
return View::make('Themes.Page', $this->data);
보기 파일에서 다음과 같이 데이터에 액세스합니다.
{{$breadcrumb}}
지금 내가하려는 것은 중첩 된 뷰에서이 데이터를 전달하는 것입니다.
$this->layout->nest('content',$page, $this->data);
(콘텐츠는 $ page 콘텐츠로 대체 될 뷰의 {{content}}입니다. 이전과 마찬가지로 $ this-> data를 전달하고 싶지만 이제 오류가 발생합니다.
가변 탐색 경로가 정의되지 않았습니다.
참고 : Laravel 버전 4.2 $ this-> layout은 생성자에서 템플릿 파일 (Themes.Page)로 설정됩니다.
실제로 부분 페이지 (탐색 경로)에 별도의 데이터를 전달할 필요가 없습니다.
$this->data['title'] = $row->title;
$this->data['breadcrumb'] = $row->bc;
return View::make('idea.show',array("data"=>$this->data));
<div>
<h1>here you can print data passed from controller {{$data['title']}}</h1>
@include('partials.breadcrumb')
</div>
<div>
<h1>here also you can print data passed from controller {{$data['title']}}</h1>
<ul>
<li>....<li>
<li>....<li>
</ul>
</div>
이에 대한 자세한 내용은 http://laravel-recipes.com/recipes/90/include-a-blade-template-within-another-template 링크를 확인 하거나 https://laracasts.com/series 비디오를 시청할 수 있습니다. / laravel-5-fundamentals / 에피소드 / 13
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다