UNIX BLOG
Blog for NIX system based administrators
Laravel header footer layout
For using a standart header and footer for every page in Laravel Framework, we need to define a layout.
This article will describe to you, how to setup a layout with header and footer in LARAVEL framework for PHP in 7 STEPS
1 STEP:
Define a layout, make a directory: app/views/layouts
2 STEP:
Create a file called default.blade.php
3 STEP:
Add your default page layout in HTML to this document.
4 STEP:
Add @yield(‘content1′), @yield(‘content2′) in code for dymanic content.
Example:
</tr>
<tr>
<td style="padding-top: 10px; padding-bottom: 10px">
@yield('content1')
</td><td>
@yield('content2')
</td>
</tr>
5 STEP:
Define layout to BaseController for global defining or to your specific controller.
Example:
class BaseController extends Controller {
public $restful = true;
protecred $layout = 'layouts.default';
6 STEP:
Now instead of using View::make(‘your_page’) use $this->layout->content=View::make(‘your_page’);
7 STEP:
In your page view ‘your_page.blade.php’ use the following syntax:
@extends('layouts.default')
@section('content1')
Your content for content1
@stop
@section('content2')
Your content for content2
@stop
Thank you for your attention.
Tags: footer, framework, header, laravel, layout, layouts, master
Articles
- Installation of Web-Scripts (4)
- Linux Administration (17)
- php coding (1)
- Xen administration (4)
Archives
- August 2015 (1)
- April 2015 (1)
- October 2014 (1)
- August 2013 (1)
- November 2012 (2)
- October 2012 (6)
- September 2012 (1)
- April 2012 (1)
- March 2012 (9)
Blogroll
- CyberSSL – best SSL products shop SSL Certificates shop and other security products and services.
Recent Posts
Tags
anti-dos
blank
blank text
centos
console
ctorrent
debian
editor
emerge
filter icmp requests
footer
framework
gentoo
header
icmp
ioctl
iptables
ipv6
ispmanager
laravel
layout
layouts
linux
listen
master
mdadm
mod_evasive
mtu
netstat
not loading
not working
php
php.exe
ports
pptp
pptpd
programs
sites
timestamp requests
torrent
vpn
windows
wordpress
xampp
xen vps
Leave a Reply