【问题标题】:Joomla bootstrap jdoc component widthJoomla bootstrap jdoc组件宽度
【发布时间】:2015-05-27 16:51:20
【问题描述】:

使用引导程序构建 Joomla 模板。

我使用3个网格如下:

<div class="row">
<div id="leftbar" class="col-xs-3">
<jdoc:include type="modules" name="leftbar" />
</div>
<div id="middle-content" class="col-xs-6">
<jdoc:include type="component" />
</div>
<div id="rightbar" class="col-xs-3">
    <jdoc:include type="modules" name="rightbar" />
</div>

当用户在我的网站上按下“论坛”时,他们会被带到我的 Kunena 论坛。问题是所述论坛是通过jdoc“组件”加载的,即使隐藏了leftbar和rightbar,也只是“col-xs-6”。我希望它延伸整个网站。

这是我可以在引导程序中更改的内容,还是 Joomla 设置? 头版是3-6-3 论坛应该是12

【问题讨论】:

    标签: twitter-bootstrap joomla kunena


    【解决方案1】:

    在显示模块之前,您应该使用countModules() 方法检查每个位置是否存在模块。

    语法是:

    <?php if ($this->countModules( 'user1' )) : ?>
      <div class="user1">
        <jdoc:include type="modules" name="user1" style="rounded" />
      </div>
    <?php endif; ?>
    

    修改了你的代码,增加了一个块用于主要区域宽度的计算。

    <?php
    $main_area_width = 12;
    if($this->countModules( 'leftbar' )) {
      $main_area_width -= 3;
    }
    if($this->countModules( 'rightbar' )) {
      $main_area_width -= 3;
    }
    ?>
    
    <div class="row">
    <?php if ($this->countModules( 'leftbar' )) : ?>
      <div id="leftbar" class="col-xs-3">
        <jdoc:include type="modules" name="leftbar" />
      </div>
    <?php endif; ?>
    <div id="middle-content" class="col-xs-<?php echo $main_area_width; ?>">
      <jdoc:include type="component" />
    </div>
    <?php if ($this->countModules( 'rightbar' )) : ?>
      <div id="rightbar" class="col-xs-3">
        <jdoc:include type="modules" name="rightbar" />
      </div>
    <?php endif; ?>
    </div>
    

    参考:JDocumentHTML/countModules

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-15
      • 2018-07-23
      • 1970-01-01
      • 2014-06-19
      • 2023-03-27
      • 1970-01-01
      • 2018-08-03
      相关资源
      最近更新 更多