PHP if/else without echo -


how replace echo proper html codes? since there hundreds of html codes, using echo doesn't make sense.

<?php if ($this->item->catid == 9) {      echo "yes, exists";      }      else {      echo "no, don't exist";      } ?> 

i'm new php.

do mean, how can 1 cleanly output many lines of html conditionally without having echo each individual line?

if that's case, trick:

<?php if ($this->item->catid == 9) {  ?>      <!--- put raw output here --->  <?php } else {  ?>      <!--- put raw output here --->  <?php } ?> 

the "raw output" sent browser. html, javascript, etc. though it's outside of server-side php tags, far php processor concerned it's still between { ... } brackets. it's output part of conditional block.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -