You need to return true or false after displaying your template:
PHP Code:
public function theme_index_main($h)
{
if ($h->isPage('my_plugin')) {
$this->mainPage($h);
return true;
}
}
The reason is the theme_main_index plugin hook in index.php is used to override the default page, which just happens to be 404error.php:
PHP Code:
<!-- MAIN -->
<?php
// plugin hook
$result = $h->pluginHook('theme_index_main');
if (!$result) {
$h->displayTemplate($h->pageName); // default is 404error.php
}
?>
$result is actually an array of values returned from all plugins using the hook, so even returning false will make $result pass the if condition. If nothing at all is returned, "Page not found" will be shown.
Bookmarks