HTML code directly in IF Conditions

This is the most amazing thing in php conditions, and exactly the if statement.
In a php condition, you can put directly a html code without the echo function :)

This is what I'm talking about, with echo function, then without.:



if ($condition == 'something') {
echo '
My Website...
'; } else { echo '
My Website...
'; } ?>
With the new way I'm talking about, the script will be like this:




 if ($condition = 'something') {?>
<div class="style1">My Website...<div>
 } else { ?>
<div class="style2">My Website2...<div>
 }?>




Now  why this can be useful ?
In fact, when you are using a html editor like dreamweaver, you will be able to design easily the html code in the if statement, you can add tables, images, div, change colors ... directly using the design view, or when you use the code view you can see the html code highlighted (like in the exemple above) wich believe me will help you a lot and make your programming so much easier !


Thank you.

2 comments:

buy fifa coins said...

Great day time. I love your site publish. Everything appears wonderful.



fifa coins online
cheap elo boost
cheap fifa coins
ultimate team coins

Robert F. Crocker said...

Awesome article! I want people to know just how good this information is in your article. It’s interesting, compelling content. Your views are much like my own concerning this subject. CodCow