[TYPO3-mvc] Syntax Property - turned to a cache problem
Kerstin Finke
kerstinfinke at hotmail.com
Wed Nov 21 11:41:52 CET 2012
Hi Sebastian, hi list,
thank you very much, Sebastian, this was a great help!
But one problem I can't solve now:
I can change the titletag (with or without the viewhelper) only if I
take my show-Action for the detailview in the list of uncacheable actions.
So I have to configure in the ext_localconf.php
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Display',
array(
'Flat' => 'list,show,contact,sendform'
),
array(
'Flat' => 'show',
)
);
instead of
Tx_Extbase_Utility_Extension::configurePlugin(
$_EXTKEY,
'Display',
array(
'Flat' => 'list,show,contact,sendform'
),
array(
)
);
Am 15.11.2012 16:14, schrieb Sebastian Schreiber:
> You have to override the page title with:
> $GLOBALS['TSFE']->page['title'] = $title
>
> But be aware of the fact that non cached plugin (USER_INT) are not able
> to override the title the way described.
> If you have a non-cached plugin you have to override the page title the
> following way:
> $GLOBALS['TSFE']->content = preg_replace('#<title>.*<\/title>#',
> '<title>' . $title . '</title>', $GLOBALS['TSFE']->content);
>
> And actually it would be better to use a viewhelper for that.
>
> class Tx_MyExt_ViewHelpers_Meta_PageTitleViewHelper extends
> Tx_Fluid_Core_ViewHelper_AbstractViewHelper {
>
> /**
> * renders a special title for the page
> *
> * @param string $title
> * @return string $content: The pagebrowser
> */
> public function render($title = NULL) {
>
> if (NULL === $title) {
> $title = $this->renderChildren();
> }
> $title = trim($title);
> if ($this->controllerContext->getRequest()->isCached()) {
> $GLOBALS['TSFE']->page['title'] = $title;
> $GLOBALS['TSFE']->indexedDocTitle = $title;
> } else {
> $GLOBALS['TSFE']->content =
> preg_replace('#<title>.*<\/title>#', '<title>' . $title . '</title>',
> $GLOBALS['TSFE']->content);
> }
>
> }
>
> }
>
> Am 15.11.2012 15:47, schrieb Kerstin Finke:
>> Dear List,
>>
>> I have a detailview in my controller. The action gets the object as
>> parameter and the detailview is shown correctly in the frontend.
>>
>> What I want now:
>>
>> I want to show the title of the object as pagetitle (instead of
>> "SingleViewPage" or something like that)
>>
>> What is the correct syntax? I tried this:
>>
>>
>> /**
>> * Show action for this controller ( SingleView)
>> * @param Tx_HnmImmo_Domain_Model_Flat $flat The flat to be shown
>> * @return string
>> */
>> public function showAction(Tx_HnmImmo_Domain_Model_Flat $flat) {
>>
>> $title = $flat->title;
>> $GLOBALS['TSFE']->indexedDocTitle = $title;
>>
>> $this->view->assign('flats', $flat);
>> }
>>
>>
>> I tried also:
>> $title = $flat->Tx_HnmImmo_Domain_Model_Flat['title'];
>>
>> Can someone please help? Thanks in advance!
>> Kerstin
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
>
More information about the TYPO3-project-typo3v4mvc
mailing list