doutuoshou8915 2014-07-14 15:21
浏览 26
已采纳

刀片模板未显示部分

I have these three blade templates

In my controller I'm calling dashboard view like this:

View::make('layouts.dashboard');

master.blade.php

<?= stylesheet_link_tag() ?>
<?= javascript_include_tag() ?>

<html>
<body class="fixed">

    <div class="wrapper">
        <div class="leftside">
            @yield('leftside', 'left-side content')
        </div>
        <div class="rightside">
            @yield('rightside', 'right-side content')       
        </div>   
    </div>

</body>

dashboard.blade.php

@extends('layouts.master')

@section('leftside')
    @yield('sidebar', 'sidebar content')
@stop

sidebar.blade.php

@extends('layouts.dashboard')

@section('sidebar')
  aaa
@stop

The dasbhoard blade shows properly in master blade, but sidebar blade doesn't want to show. Does anyone know what i'm doing wrong?

Thank your very much for any help :)

  • 写回答

2条回答 默认 最新

  • douyanlu7380 2014-07-14 15:44
    关注

    I don't think you can use yield() on a blade template that is not called.

    Basically what you can do is make your master.blade.php into this

    <html>
    <body class="fixed">
        <div class="wrapper">
            <div class="leftside">
                @include('sidebar') {{-- This is sidebar.blade.php --}}
            </div>
            <div class="rightside">
                @include('dashboard') {{-- This is dashboard.blade.php --}}      
            </div>   
        </div>
    </body>
    </html>
    

    Then, assuming that your are calling the dashboard.blade.php template, with both blade templates included. You can use the sections on either master.blade, or sidebar.blade inside dashboard.blade

    @extends('layouts.master')
    
    {{-- You can define now the sections available on master.blade and dashbard.blade --}}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)