KriiV
KriiV

Reputation: 2020

Laravel not yielding

I had a look at other questions and the problem with them seems to be they are referencing the wrong blade file and not extending from the parent.

My yield('section') isn't working.

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 (inside: views/layout)

<!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>

The yield('section') doesn't work. Not sure what to do anymore. Any help? Thanks!

Upvotes: 0

Views: 661

Answers (1)

Sab
Sab

Reputation: 36

replace @content('section') to @section('section')

and check out http://laravel.com/docs/templates its well explained there

Upvotes: 2

Related Questions