Book Image

concrete5 Beginner's Guide

Book Image

concrete5 Beginner's Guide

Overview of this book

Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – specifying block template in area


Sometimes you might want to set a default block template for an area. This might happen if the default template doesn't work at all and the customer would have to select a custom template for each block he adds. Let's save his time and specify a block template in our template:

  1. Open a theme template like default.php

  2. Look for the PHP block which defines an area and insert the highlighted line from the following snippet:

    <?php
    $b = new Area('Main');
    $b->setCustomTemplate('autonav', 'templates/header_menu');
    $b->display($c);
    ?>

What just happened?

The single line of code that we've added to our theme templates makes sure that for every autonav block where no template has manually been specified in the user interface, the header_menu template is used.

While setting header_menu for all autonav blocks is probably a bit useless, you'll learn how to build your own block templates in the next chapter. Once you've created your own templates...