[TYPO3-mvc] Determine f:layout dynamically

Markus Klein klein.t3 at mfc-linz.at
Thu Oct 10 17:56:46 CEST 2013


Unfortunately this now has another problem.

My code looks like this:
-----------
$template = $this->getFluidTemplate();
/* @var $template \TYPO3\CMS\Fluid\View\StandaloneView */
$template->setTemplateSource($file);
$template->assign('logo', $image);

$htmlTemplate = $template->render();

$template->setFormat('txt');
$textTemplate = $template->render();
-----------

The content of $file is just "<f:layout name="Mail" />".
I have two layouts Mail.html and Mail.txt.
Both contain "<f:render partial="Address" arguments="{person:person}" />"
And I've two partials Address.html and Address.txt.

Unfortunately the $textTemplate finally contains the contents of Address.html, although the rest is coming from the Mail.txt file.
It looks like some cache is not properly cleared when changing the format. :-(

Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member


> -----Original Message-----
> From: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-
> project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of Markus Klein
> Sent: Thursday, October 10, 2013 4:11 PM
> To: 'TYPO3 v4 MVC project'
> Subject: Re: [TYPO3-mvc] Determine f:layout dynamically
> 
> Hi Jigal!
> 
> Thanks a lot. A feature I didn't know. ;-)
> 
> Kind regards
> Markus
> 
> ------------------------------------------------------------
> Markus Klein
> TYPO3 CMS Active Contributors Team Member
> 
> 
> > -----Original Message-----
> > From: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-
> > project-typo3v4mvc-bounces at lists.typo3.org] On Behalf Of Jigal van
> > Hemert
> > Sent: Thursday, October 10, 2013 3:54 PM
> > To: typo3-project-typo3v4mvc at lists.typo3.org
> > Subject: Re: [TYPO3-mvc] Determine f:layout dynamically
> >
> > Hi,
> >
> > On 10-10-2013 14:53, Markus Klein wrote:
> > > Hi!
> > >
> > > It's not so easy. ;-)
> > >
> > > My usecase here is to render E-Mails with a Standalone template.
> > >
> > > The template shall render HTML and Text E-Mails, hence it should
> > > switch
> > the layout.
> > > <f:layout name="{f:if(condition: isHtml, then:'MailHtml',
> > > else:'MailText')}" />
> >
> > In this case I would use two different formats (like you can set in
> > FLUIDTEMPLATE.format). The default format is 'html', which uses the
> > template with .html extension. If you switch to format 'txt' fluid
> > would use the *.txt templates.
> >
> > --
> > Jigal van Hemert
> > TYPO3 CMS Active Contributor
> >
> > TYPO3 .... inspiring people to share!
> > Get involved: typo3.org
> > _______________________________________________
> > TYPO3-project-typo3v4mvc mailing list
> > TYPO3-project-typo3v4mvc at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4m
> > vc
> 
> _______________________________________________
> 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