Issue
I have 8 different Flash elements.
4 of them are like these:
growl_success
growl_error
growl_info
growl_warning
The other 4 are:
alert_success
alert_error
alert_info
alert_warning
I want to make it flexible so that at the Controller end, I can freely switch between any of these 8.
The problem is I want the <?= $this->Flash->render() ?>
to be at different places in the layout.ctp
for growl
type messages compared to alert
type messages.
Is there a way I can do something like
<?php if ($this->Flash->startsWith('growl') : ?>
<?= $this->Flash->render() ?>
<?php endif; ?>
or
<?= $this->Flash->renderGrowl(); ?>
Solution
I think you can use the 'key' options when setting the message
in your controller
$this->Flash->alert_success(__('Alert success!!'), [
'plugin' => 'PluginName', 'key' => 'alert']);
or alternatively
$this->Flash->growl_success(__('The project has been saved.'), [
'plugin' => 'PluginName', 'key' => 'growl']);
in your layout in two different positions
<?= $this->Flash->render('growl'); ?>
...
<?= $this->Flash->render('alert'); ?>
Answered By - arilia
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.