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/she adds. Let's save his/her time and specify a block template in our template.
Open a theme template like
default.php
.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); ?>
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...