[TYPO3-english] JS + Fluid + Flash messages
Sergio Catalá
scatala.enet at gmail.com
Fri May 10 15:57:10 CEST 2013
Hi list,
I'm integrating the flash messages with a JS library (Pines notify) in
my website and I need to make calls to a certain JS function every time
there is a flash message.
For that purpose, I create a plugin whose result is displayed in a
certain region of the page. This plugin assigns to "flashMessages"
variable all flash messages in my queue:
$this->view->assign('flashMessages',
$this->controllerContext->getFlashMessageContainer()->getAllMessagesAndFlush());
The problem comes with my fluid template because I need to make JS calls
like this:
$.pnotify({
text: {flashMessage.message},
type: 'success'
});
inside my for structure:
<f:if condition="{flashMessages}">
<f:then>
<f:for each="{flashMessages}" as="flashMessage"
iteration="iterator">
...
</f:for>
</f:then>
</f:if>
What would you recommend me? Some threads say using JS inline and "CDATA
wrappers", others say using external JS.
How would you implement this?
Thanks in advance,
Sergio
More information about the TYPO3-english
mailing list