Laravel没有屈服

时间:2014-08-10 13:13:12

标签: laravel blade

我查看了其他问题,他们的问题似乎是他们引用了错误的刀片文件,而不是从父级扩展。

我的yield('section')无效。

HomeController.php

class HomeController extends BaseController {
        public function home() {
        return View::make('login');
    }
}

home.blade.php

@extends('layout.slim')

@content('section')
    Some content
@stop

slim.blade.php(内部:观看/布局)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>test</title>

    <!-- Stylesheets -->
    {{ HTML::style('css/bootstrap.min.css'); }}
    {{ HTML::style('css/animation.css'); }}
    {{ HTML::style('css/checkbox/orange.css'); }}
    {{ HTML::style('css/preview.css'); }}
    {{ HTML::style('css/authenty.css'); }}

    <!-- Font Awesome CDN -->
    {{ HTML::style('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css'); }}

    <!-- Google Fonts -->
    {{ HTML::style('http://fonts.googleapis.com/css?family=Roboto+Slab:400,700,300'); }}
    {{ HTML::style('http://fonts.googleapis.com/css?family=Open+Sans:300,400,700'); }}

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    {{ HTML::script('https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js'); }}
    {{ HTML::script('https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js'); }}
    <![endif]-->
</head>

<body>
<section id="authenty_preview">
@yield('section')
</section>

    <!-- js library -->
    {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js'); }}
    {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js'); }}
    {{ HTML::script('js/bootstrap.min.js'); }}
    {{ HTML::script('js/jquery.icheck.min.js'); }}
    {{ HTML::script('js/waypoints.min.js'); }}

    <!-- authenty js -->
    {{ HTML::script('js/authenty.js'); }}


    <!-- preview scripts -->
    {{ HTML::script('js/preview/jquery.malihu.PageScroll2id.js'); }}
    {{ HTML::script('js/preview/jquery.address-1.6.min.js'); }}
    {{ HTML::script('js/preview/scrollTo.min.js'); }}
    {{ HTML::script('js/preview/init.js'); }}

    <!-- preview scripts -->
    <script>
        (function($) {

            // get full window size
            $(window).on('load resize', function(){
                var w = $(window).width();
                var h = $(window).height();

                $('section').height(h);
            });

            // scrollTo plugin
            $('#signup_from_1').scrollTo({ easing: 'easeInOutQuint', speed: 1500 });
            $('#forgot_from_1').scrollTo({ easing: 'easeInOutQuint', speed: 1500 });
            $('#signup_from_2').scrollTo({ easing: 'easeInOutQuint', speed: 1500 });
            $('#forgot_from_2').scrollTo({ easing: 'easeInOutQuint', speed: 1500 });
            $('#forgot_from_3').scrollTo({ easing: 'easeInOutQuint', speed: 1500 });


            // set focus on input
            var firstInput = $('section').find('input[type=text], input[type=email]').filter(':visible:first');

            if (firstInput != null) {
                firstInput.focus();
            }

            $('section').waypoint(function (direction) {
                var target = $(this).find('input[type=text], input[type=email]').filter(':visible:first');
                target.focus();
            }, {
                offset: 300
            }).waypoint(function (direction) {
                    var target = $(this).find('input[type=text], input[type=email]').filter(':visible:first');
                    target.focus();
                }, {
                    offset: -400
                });


            // animation handler
            $('[data-animation-delay]').each(function () {
                var animationDelay = $(this).data("animation-delay");
                $(this).css({
                    "-webkit-animation-delay": animationDelay,
                    "-moz-animation-delay": animationDelay,
                    "-o-animation-delay": animationDelay,
                    "-ms-animation-delay": animationDelay,
                    "animation-delay": animationDelay
                });
            });

            $('[data-animation]').waypoint(function (direction) {
                if (direction == "down") {
                    $(this).addClass("animated " + $(this).data("animation"));
                }
            }, {
                offset: '90%'
            }).waypoint(function (direction) {
                    if (direction == "up") {
                        $(this).removeClass("animated " + $(this).data("animation"));
                    }
                }, {
                    offset: '100%'
                });

        })(jQuery);
    </script>
</body>
</html>

yield('section')不起作用。不知道该怎么做。有帮助吗?谢谢!

1 个答案:

答案 0 :(得分:2)

@content('section')替换为@section('section')

并查看http://laravel.com/docs/templates其解释得很好