PHP is pretty cool, you can stop / resume it in the middle of the document. For example, for example, I hope this is a solution to what you were trying to do:
<?php if(isset($_SESSION['email'])) { ?> <a href="http://localhost/ci/myads_view"> <nav class="main-navigation dd-menu toggle-menu" role="navigation"> <ul class="sf-menu"> </a> <?php } ?>
So what is going on?
First, you write your IF statement and curly braces, the code inside which is usually executed if the IF statement evaluates to TRUE.
<?php if(something==true) { echo "write something to the page"; } ?>
But instead of using PHP commands, do you quickly exit PHP by closing the PHP tag? > as at the end of your PHP code.
<?php if(something==true) { ?>
Now you can continue in plain HTML without all the usual problematic PHP commands, such as escaping characters like "and" and "viewing" qoute level, etc. Instead, you write standard HTML code.
When you finish entering the HTML code that should be output if the IF statement is true, just open another PHP tag and close the curly braces of the IF statement, and if this is the end of your PHP, close the PHP tag as well.
<?php } ?>
source share