Welcome Guest, Not a member yet? Register   Sign In
Passing a view to a flashdata variable
#1

[eluser]fdog[/eluser]
I have the following code:

Controller:
Code:
$notice = $this->load->view('error_view', array('msg'=>'Reservation not saved'), TRUE);

// echo $notice    Works as expected

$this->session->set_flashdata('notice', $notice);

redirect('/some_place/');

View:
Code:
<?=($this->session->flashdata('notice'))?>  //bool(false) :(

I'm not getting the flashdata in the view. Any ideas?
#2

[eluser]TheFuzzy0ne[/eluser]
How big is your view? I see absolutely no reason why you should need to store a view in flashdata. It would make more sense to only pass the name of the view, and perhaps any variables required that aren't available on the next request.
#3

[eluser]fdog[/eluser]
The View is this big:

Code:
<div class="ui-widget">
    <div class="ui-state-highlight ui-corner-all" style="position:absolute; margin-left: 600px; margin-top: 20px;">
        <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
        <strong>Notification: </strong> &lt;?=$msg?&gt;</p>
    </div>
</div>

Maybe it was a dumb idea to begin with Tongue I'll try something different.
#4

[eluser]darkhouse[/eluser]
Yes, you should be using flashdata to store a value that will tell your application whether or not to load that view... don't store the view in flashdata.




Theme © iAndrew 2016 - Forum software by © MyBB