dongzu0742 2011-02-01 12:20
浏览 34
已采纳

在joomla模板中,如何使第一页与带文章的页面不同?

I'm creating a Joomla 1.6 template and I would like to make the first page different from the others (I say, the others with articles). What I expect is something like it:

<?php
if(this_page_link_to_an_artcile || this_page_is_not_the_main) {
   ?> <jdoc:include type="component" /> <?php
}
?>

I looked in one of the standard templates and got somewhat lost trying to find the "if" which makes not be showed in some pages.

  • 写回答

4条回答 默认 最新

  • dpv46227 2011-02-02 14:50
    关注
    // Is Frontpage?
    $option = JRequest::getCmd('option');
    $view = JRequest::getCmd('view');
    
    $frontpage = ($option == 'com_content' && $view == 'featured')
    $is_article = ($option == 'com_content');
    if ($is_article && !$frontpage)
    {
        // ...
    }
    

    (EDIT: now works in Joomla! 1.6)

    ($is_article || !$frontpage should always return true ... because if it is not an article, it is not the frontpage. Depends on how you define "is an article", of course.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度