[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.