使用引导程序构建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“组件”加载的,即使隐藏了左栏和右栏,也只是"col-xs-6“。我要它延伸到整个网站。
这是我可以在引导中改变的东西,还是一个Joomla设置?首页是3-6-3,论坛应该是12。
发布于 2015-05-28 22:18:43
在显示模块之前,应该使用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/计数模块
https://stackoverflow.com/questions/30488657
复制相似问题