简体   繁体   中英

Joomla show content if current article category id is

i am using joomla 2.5 and i want to show some special text only in those articles which belongs to category id 11.

to get category id i tried:

<?php $catid = JRequest::getInt('catid'); echo $catid; ?>

to check if current category id is 11 and then show special text i used:

<?php $catid = JRequest::getInt('catid'); if ($catid == 11) {?>SPECIAL TEXT<?php } ?>

but it is not working :( text can be seen in all categories.

Your if statement doesn't look right... try this:

<?php $catid = JRequest::getInt('catid'); if ($catid == 11) : ?>SPECIAL TEXT<?php endif; ?>

See "Alternative syntax for control structures" on php.net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM