Creating a Section



By default Coaster comes with two sections, a header section and a footer section. Sections can be used for elements that you may want to use sitewide across a majority of templates. The advantage of using sections is that if you wish to make a sitewide theme change you won't have to go through each individual template file.

{!! PageBuilder::section($section_name, $options = array()) !!}

Template Locations






Below is an example of the default header section:

<!DOCTYPE html>
<html lang="en">
<head itemscope>
    <meta charset="utf-8">
    <title>{!! PageBuilder::block('meta_title', array('meta' => true)) !!}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="{!! PageBuilder::block('meta_description', array('meta' => true)) !!}">
    <meta name="keywords" content="{!! PageBuilder::block('meta_keywords', array('meta' => true)) }}">
  	<meta property="og:title" content="{!! PageBuilder::block('meta_title') !!}">
  	<meta property="og:description" content="{!! PageBuilder::block('meta_description') !!}">
  	<meta itemprop="name" content="{!! PageBuilder::block('meta_title') !!}">
  	<meta itemprop="description" content="{!! PageBuilder::block('meta_description') !!}">
  	<meta name="revisit-after" content="7 days">
    <meta name="google-site-verification" content="iOm3RU2-ZpUmsvDRDC3rTavC0uUhB3FuZUpNRqJSm-0" />
    <meta name="msvalidate.01" content="701B6B47E0A450809C3FF2FB9873BA7D" />
    <link href="{!! PageBuilder::css('bootstrap') !!}" rel="stylesheet">
    <link href="{!! PageBuilder::css('bootstrap-responsive') !!}" rel="stylesheet">
    <link href="{!! PageBuilder::css('webfeet') !!}" rel="stylesheet">

    <link href='|Raleway:400,500,600' rel='stylesheet' type='text/css'>

    <!--[if lt IE 9]>
    <script src=""></script>

    {!! PageBuilder::block('header_html', array('source' => true)) !!}



{!! PageBuilder::menu('main_menu') !!}

@if (PageBuilder::page_template() != 1)
<div class="hero-unit-internal">

Much of the code found in the header consists of what you'd commonly expect - meta tags, stylesheets and the occasional script (although we'd generally recommend you put scripts in the footer).

The PageBuilder class features a CSS method that calls the named CSS file from /public/themes/your_theme/css, the .css extension is not required. Calling a JavaScript file is much the same except the method is instead js and the directory in which JS files are stored is /public/themes/your_theme/js. These two methods only call the URL of the file, so the conventional HTML such as <script src... is still required.

As you can see this is where sections really shine as you'll likely want to be using the same stylesheets and scripts across your site. Conditionals can also be used to render template specific code. You may for example only want your banners to show up on the homepage. An example for doing this can be found below:

@if (PageBuilder::page_template() != 1)
{!! PageBuilder::block('banners') !!}

There are of course different ways of having template specific sections on your pages. A similar way to achieving the above would be to simply have the above code without the conditional only on the homepage template and nothing else.

You may have noticed the menu method in the code above, more can be read on creating menus in our creating a menu documentation.

Modern Framework

Based on Laravel 5.3

Constant development

Additional features always being planned/researched


Years in development

Latest from the blog

read more

read more

read more