You could use smth like this
@include('view.name')
Oh Thanks for reply. But I need a custom include: different for each controller method
Set views path as variable in a controler and use in a blade file like so
@inlclude($customViewPath)
P.S. If you are using those views for assrt loading than maybe you shold check something like this package
Just an example:
Your controller:
class HomeController extends BaseController {
public $jsfiles = ['jquery.js', 'bootstrap.js'];
public function index() {
return View::make('home.index')->with('jsfiles', $this->jsfiles);
}
}
layouts/master.blade.php
@section('js')
{{-- default js to show in all pages --}}
{{ HTML::script('default.js') }}
@show
@yield('content')
home/index.blade.php
@extends('layouts.master')
@section('js')
parent // add @ before this call, forum doesnt render it
@if($jsfiles)
@foreach($jsfiles as $js)
{{ HTML::script($js) }}
@endforeach
@endif
@stop
@section('content')
{{ 'my content' }}
@stop
Oh. Thanks all. I think diego1araujo reached my target. The package, instead, is too much for me. Thanks again
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community