Welcome Guest, Not a member yet? Register   Sign In
Displaying html only if condition is true
#1

[eluser]Dagobert Renouf[/eluser]
Hello guys,

I have some part of my controller that populates the $data array with an "admin_notification" value only if there is a notification.
To avoid errors in my view, I first set $data['admin_notification'] = "".

Here's my problem: I can't wrap the <?= $admin_notification; ?> in any paragraph or thing like that, because in the case of no notification and depending on my css, this would display an empty box (concidering it is wrapped in a box) and I just don't want any box at all.

So as I don't know if the notification exists in the view, I need to wrap data in my controller before sending it to the view (example : $data['notification'] = '<p>' . $error . '</p>';

I'm forced to put my html in my controller and that sucks !

How do I make it clean ?


Messages In This Thread
Displaying html only if condition is true - by El Forum - 07-09-2008, 07:44 AM
Displaying html only if condition is true - by El Forum - 07-09-2008, 08:01 AM
Displaying html only if condition is true - by El Forum - 07-09-2008, 08:09 AM
Displaying html only if condition is true - by El Forum - 07-09-2008, 08:28 AM
Displaying html only if condition is true - by El Forum - 07-09-2008, 08:33 AM
Displaying html only if condition is true - by El Forum - 07-09-2008, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB