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

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -