dongzi0602 2013-04-02 17:40
浏览 15
已采纳

如果当前文章类别ID是Joomla显示内容

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.

  • 写回答

1条回答 默认 最新

  • douning5041 2013-04-02 23:05
    关注

    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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败