I tried to create a page object and then replace the values in it with custom ones.
See the code below:
$page = page('home');
page::$methods['title'] = function($page) {
return 'CUSTOM TITLE';
};
$page->title = 'CUSTOM TITLE';
echo $page->title();
It still says:
Home
It works for values that does not exists
$page = page('home');
page::$methods['title1'] = function($page) {
return 'CUSTOM TITLE1';
};
$page->title1 = 'CUSTOM TITLE2';
echo $page->title1();
CUSTOM TITLE2
In this case it does not help me, as I need to overwrite them, not create new ones.
Is there a way to overwrite $page
object values?