Welcome Guest, Not a member yet? Register   Sign In
Show alert message on load view
#8

[eluser]Barwick[/eluser]
[quote author="Barwick" date="1352820392"]Also, don't think you should be calling an alert function in a variable. Essentially, that's exactly what the $data array is outputting anyways...unless I'm misunderstanding your use of the $data variable. Is that loading data into a view? Set it up something like this...

Code:
//Controller:

$data['alert'] = ''; // no alert

if (something happens)
{
   $data['alert'] = 'ALERT!';  // If "something" happens, alert
}

$this -> load -> view('view_name', $data); // pass $data into view

//Then in your view...you can output the alert...
<?php echo $alert; ?>
[/quote]

You could even ditch the "empty" alert altogether, and use this in your view instead of the echo:

Code:
<? if (isset($alert)) : ?>

I'm no CI pro, so take my tactics with a grain of salt. Someone may chime in with some better advice. Smile


Messages In This Thread
Show alert message on load view - by El Forum - 11-13-2012, 04:04 AM
Show alert message on load view - by El Forum - 11-13-2012, 04:43 AM
Show alert message on load view - by El Forum - 11-13-2012, 04:43 AM
Show alert message on load view - by El Forum - 11-13-2012, 07:31 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:14 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:24 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:26 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:29 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:33 AM
Show alert message on load view - by El Forum - 11-13-2012, 08:37 AM
Show alert message on load view - by El Forum - 11-13-2012, 09:58 AM
Show alert message on load view - by El Forum - 11-13-2012, 10:52 AM
Show alert message on load view - by El Forum - 11-13-2012, 11:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB