我正在尝试在我的Extbase扩展的单个视图中更改浏览器页面标题,但是我所有的尝试都失败了:
/**
* action show
*
* @param \Vendor\Abc\Domain\Model\Abc $record
* @return void
*/
public function showAction(\Vendor\Abc\Domain\Model\Abc $record) {
$this->view->assign('record', $record);
//$GLOBALS['TSFE']->page['title'] = $record->getAbc();
//$GLOBALS['TSFE']->indexedDocTitle = $record->getAbc();
//$GLOBALS['TSFE']->page['title'] = $record;
//$GLOBALS['TSFE']->indexedDocTitle = $record;
//$GLOBALS['TSFE']->additionalHeaderData['CustomUserIntTitle']
//= '<title>' . $this->getAbc($record) . '</title>';
//$myNewTitle = 'Title';
//$title = '<title>' . $myNewTitle . '</title>';
//$this->response->addAdditionalHeaderData($title);
//$GLOBALS['TSFE']->content = preg_replace('#<title>.*<\/title>#', '<title>' . $record->getTitle() . '</title>', $GLOBALS['TSFE']->content);
//$this->response->addAdditionalHeaderData('<title>Mein eigener Title</title>');
}
我将该操作注册为不可缓存(不确定是否需要)。