Tuesday, December 15, 2009

Quick tip: how to change page title in a frontend module or template

A common needs while working with Contao is to set the page title from a frontend module or inside a template.

For modules:

class MyModule extends Module {
protected function compile() {
// ... your code ...
$GLOBALS['objPage']->pageTitle = 'My custom title';
// ... your code ...
}
}

For templates:

<?php $GLOBALS['objPage']->pageTitle = 'My custom title'; ?>

No comments:

Post a Comment