php - Detect Category ID=4 in Joomla and show div -


i detect category id=4 , apply if/else add div display contents.

<?php      if (jrequest::getvar('view')=='categories' && jrequest::getvar('id')==4) { ?> <?php } ?> 

how achieve this? want show if article belongs category 4 else show div.

imagining 2 different div

<div class="category4">text here</div> <div class="categoryxxx">text here</div> 

do note <?php echo $this->item->catid;?> shows correct category id. apply if , else statement using catid==9 or something. not @ php.

you can put directly html code, avoiding echo. may useful when html code sizeable.

<?php if ($this->item->catid == 4): ?>  <div class="category4">text here</div> <!--- other html code --->  <?php else: ?>  <div class="categoryxxx">text here</div> <!--- other html code --->  <?php endif; ?> 

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? -