I wanted to add a single variable to the page object and make it available to the templates. However since the Template object is declared as protected I cannot add the variable in the GeneratePage hook.
The hook is implemented in PageRegular.php line 82: $GLOBALS['TL_HOOKS']['generatePage']
I tried:
Code:
class Subtitle
{
public function onGeneratePage(Database_Result $objPage, Database_Result $objLayout, PageRegular $objPageRegular)
{
$objPageRegular->Template->subTitle = $objPage->subTitle;
}
}
but that generates the errormessage:
Fatal error: Cannot access protected property PageRegular::$Template in C:\xampp\htdocs\domainname.com\system\modules\subt itle\Subtitle.php on line 7 (that is inside the function).
Is there another method to get what I want?
In the meantime I edited the core to just include that one line of the function; problem diverted. I dislike the protected and private statements...
Bookmarks