php - Appending into @section -


i'm using laravel 4 , i'd extend what's placed in master.blade.php template.

<!doctype html> <html>     <head>     @section('head')         @parent         <meta charset="utf-8">         <meta http-equiv="x-ua-compatible" content="ie=edge">         <title>{{$title}}</title>         <meta name="description" content="{{$description}}">         <meta name="viewport" content="width=device-width, initial-scale=1">          <link rel="stylesheet" href="{{ asset('assets/css/main.css') }}">     @show     </head>     <body>     ... 

for example, home.blade.php template:

@section('head'); appending head.... @show  @section('content')     <h2>hello world</h2> @show 

so trying append "appending head..." template. replaces what's there. research came conclusion it's not possible, i'm not sure how else this.. partials? includes?

what can do?

use code in home.blade.php template extends master.blade.php:

this home.blade.php

@extends('master')  @section('head')   @parent    {{{ $head_data }}} @stop  {{-- content --}} @section('content')   here comes content... @stop 

you can call controller

<?php  class homecontroller extends controller {    public function getindex()   {      $head_data = 'appending head....';      return view::make('home', compact('head_data'));   }  } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -