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()) !!}
/sections/[section_name].blade.php
ie.
/sections/head.blade.php
/sections/footer.blade.php
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='http://fonts.googleapis.com/css?family=Prata|Raleway:400,500,600' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{!! PageBuilder::block('header_html', array('source' => true)) !!}
</head>
<body>
{!! PageBuilder::menu('main_menu') !!}
@if (PageBuilder::page_template() != 1)
<div class="hero-unit-internal">
</div>
@endif
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') !!}
@endif
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.
Based on Laravel 5
Additional features always being planned/researched
"git" involved
Announcing (belatedly) Coaster CMS version 5.5...
So, somewhat belatedly we have launched Coaster CMS version 5.5, which is now based on Laravel v5.5 (LTS) and mostly includes a major "under the hood" update that will make Coaster more stable and als...
Coaster CMS v5.4 is here
So, Coaster CMS v5.4 has arrived and I'm just going to give you an overview of the new features. We think this update will really help people grasp the concepts around Coaster and give you ideas o...
Where is Data Stored in Coaster CMS
We've had a couple of discussions recently with people trying to understand the data structure of Coaster and more specifically, where data is stored in Coaster CMS and I thought I'd summarise some of...