I'm experiencing an issue in CakePHP 2.0 whereby my flash does not render as expected. Consider the following example of my configuration:
app\View\Layouts\default.ctp:
<!-- flash echoed below -->
<div id="main_flash">
<?PHP echo $this->Session->flash(); ?>
</div>
app\View\Objects\index.ctp:
<!-- no flash echoed here -->
app\View\Object\edit.ctp:
<!-- flash echoed below -->
<div id="edit_flash">
<?PHP echo $this->Session->flash(); ?>
</div>
When I navigate to mysite.com/objects/, the flash (if set) successfully renders:
<div id="main_flash">Hello World!</div>
Now, whenever I edit an object mysite.com/objects/edit/12, the flash renders as shown below. The flash wouldn't render at all before I added the echo to edit.ctp:
<div id="edit_flash">Hello World!</div>
Is there any way to have my flash always render from default.ctp i.e. without having to echo the flash in individual view files? Right now, one flash statement works while the other is ignored.
No comments:
Post a Comment