Aspen:Module Headers

From Aspen Documentation

It's often necessary for the modules to insert additional elements into the page header. The global application header file exists separately from any modules.

However, there are two ways you can automatically include additional header templates from your modules.

The first method is to simply use a function that checks for a header.tpl.php in the proper templates directory. This function is to be placed in your global header template, inside the head element tags:

<?php $this->loadModuleHeader(); ?>

The drawback to this function is that any variables that have been provided to the templates from your controller will not be available because of scope issues.

The second method is to directly include the file if it exists. Because the file is included directly there are no scope issues.

<?php if(file_exists($this->getModuleTemplateDir().DS.'header.tpl.php')){
include($this->getModuleTemplateDir().DS.'header.tpl.php');
} ?>