[Solved] PHP if/else without echo

[ad_1]

Do you mean, how can one cleanly output many lines of HTML conditionally without having to echo each individual line?

If that’s the case, something like this would do the trick:

<?php
if ($this->item->catid == 9) { 
?>

    <!--- put all the raw output you like here --->

<?php
} else { 
?>

    <!--- put all the raw output you like here --->

<?php
}
?>

The “raw output” would be anything sent to the browser. HTML, JavaScript, etc. Even though it’s outside of the server-side PHP tags, as far as the PHP processor is concerned it’s still between the { ... } brackets. So it’s only output as part of that conditional block.

[ad_2]

solved PHP if/else without echo