【问题标题】:Exclude a view from master layout?从主布局中排除视图?
【发布时间】:2014-05-24 02:44:50
【问题描述】:

我在views/users/ 中有login.blade.php,我想从我拥有的主布局中排除。

相反,我希望登录页面是一个独立的页面,上面只有登录表单。

我怎样才能做到这一点?

【问题讨论】:

    标签: php laravel laravel-4 blade


    【解决方案1】:

    为登录页面使用不同的布局:

    文件app/views/login.blade.php

    @extends('layouts.standalone')
    
    @section('content')
       ...
    @stop
    

    对于您的其他页面:

    文件app/views/home.blade.php

    @extends('layouts.master')
    
    @section('content')
       ...
    @stop
    

    这里是你的布局:

    文件app/views/layouts/standalone.blade.php

    <html>
       <body>
          This is a master layout
    
          @yield('content')
       </body> 
    </html>
    

    文件app/views/layouts/master.blade.php

    <html>
       <body>
          This is a standalone layout
    
          @yield('content')
       </body> 
    </html>
    

    【讨论】:

    • 我按照你的建议做了,但我仍然在登录页面上看到属于主主布局的标题和侧边栏。这是Login Master Layout 这是Login View
    • 必须在您的布局或视图中。 Smartadmin 非常庞大,我也在这里使用它。从较小的东西开始,删除所有那些 smartadmin html 和 css,只是为了测试,只留下一个基本的 html、表单和输入,然后逐步添加标记。
    猜你喜欢
    • 1970-01-01
    • 2011-01-09
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 2016-11-10
    • 1970-01-01
    相关资源
    最近更新 更多