Pregunta

I need to display a flash message but the message gets gobbled up by another extension, so can I do something like this:

in my controller:

$message = t3lib_div::makeInstance('t3lib_FlashMessage', 'Valid.', 'Message Header', t3lib_FlashMessage::OK, FALSE );
$message->render();
echo "<br/>".__FUNCTION__.__LINE__."<br/>";  
$this->redirect('validate_success');

and have the message show up somewhere on my page, but where, what tag? Or should I handle the passing of messages differently altogether?

I use typo3 v 4.5.3 extbase 1.3 Thanks

¿Fue útil?

Solución 2

This is how I do it now:

$this->redirect('validate_failed', 'Coupon', 'coupons', array('coupon' => $result, 'filename' => $filename, 'message' => 'Expired.'));

avoiding the whole flashmessage thing and passing a other stuff I want as well.

and this is my couponcontroller method that catches that redirect:

/**
 * action validate
 * @param Tx_Coupons_Domain_Model_Coupon  $coupon
 * @param string $filename
 * @param string $message
 * @return void
 */
public function validate_failedAction(Tx_Coupons_Domain_Model_Coupon $coupon = NULL, $filename = '', $message = '') {
    $this->view->assign('coupon', $coupon);
    $this->view->assign('filename', $filename);
    $this->view->assign('message', $message);
}

Otros consejos

If you redirect with $this->redirect() the echo in the same action will never appear.

Correct usage of FlashMessage in TYPO3 4.5

In your controller/action:

$this->flashMessageContainer->add("Your message body", "Your message header", t3lib_FlashMessage::OK);

This will add the FlashMessage to a container which holds all FlashMessages in a global scope.

In your fluid template of the action you redirected to:

<f:flashMessages renderMode="div" />

Alternatively you can use renderMode="ul".

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top