PHP noob here. A company I do work for has an if/else statement set up like this:
{if product_type != ""} {product_type} {if:else}No Product Type{/if}
Other research I do though provides a format such as the following:
<?php if ($bodyID==='home') { ?>
<h1>I am home!</h1>
<?php } else { ?>
<p>I'm not home!</p>
<?php } ?>
Is there a specific reason for the differences in syntax, or is that just how the previous developer wrote it?
The first one is not php, it is a template engine, possibly https://ellislab.com/expressionengine/user-guide/templates/conditionals.html . The second one is valid php code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With