[Solved] HTML Title for the CustomPage Plugin
Anyone knows how to override the HTML page title for a custom page created by the custom page plugin?
0
Best Answers
-
Todd
Vanilla Staff
I'm not 100% familiar with the plugin, but the following should work if you put it in the custom page php file:$this->SetData('Title', 'Foo');or$this->Head->Title('Foo')Those both do something slightly different, so try them both out and see what you like.1 -
Todd
Vanilla Staff
Oh okay, I think Gdn::Controller() may be in the current release then. Just try$this->SetData('Title', 'Foo').2
Answers
$this->SetData('Title', 'Foo');or$this->Head->Title('Foo')Those both do something slightly different, so try them both out and see what you like.Here is what the custom plugin code looks like:
public function PluginController_Page_Create(&$Sender) {Then on the default.php which is a custom page, I dont think I can do:// See what page was requested
$Page = ArrayValue('0', $Sender->RequestArgs, 'default');
..............
$Path = PATH_PLUGINS . DS . 'CustomPages' . DS . 'pages' . DS;
............
$Sender->Title('Generic title for all custom pages');
$Sender->MasterView = $MasterView;
$Sender->Render($Path.$Page.'.php');
}
Gdn:Controller()->Head->Title('Foo')$thisin the view.I tried
<?php Gdn::Controller()->SetData('Title', 'Foo'); ?>or
<?php Gdn:Controller()->Head->Title('Foo')?>It says:
Fatal error: Call to undefined method Gdn::controller() in ......
$this->SetData('Title', 'Foo').