如何在joomla 3中使用if countmodules的不同bootstrap类

时间:2016-03-30 09:32:40

标签: twitter-bootstrap joomla

我对joomla和bootstrap模板有疑问。

我从头开始为joomla构建的模板存在问题。 想要构建这个模板的客户给了我一个来自其他cms的演示,并希望我为他构建模板,直到现在还可以。如果您想看到它,那么演示就在这里 - > http://www.templatemonster.com/demo/49165.html

我需要一些if countmodules语句的帮助,为我在主要部分(sidebar-l和component)中使用的div使用不同的bootstrap类。

如果sidebar-module存在,我想使用3-column-class作为sidebar-left-position,使用component作为9的类,如果sidebar left position不存在,则使用12的类组件。

任何帮助?

1 个答案:

答案 0 :(得分:0)

  1. 您的主题2列布局。我们需要看看你的index.php
  2. 阅读Joomla protostar模板index.php
  3. 你会得到解决方案。

        // Adjusting content width
    if ($this->countModules('position-7') && $this->countModules('position-8'))
    {
        $span = "span6";
    }
    
    <main id="content" role="main" class="<?php echo $span;?>">
                    <!-- Begin Content -->
                    <jdoc:include type="modules" name="position-3" style="xhtml" />
                    <jdoc:include type="message" />
                    <jdoc:include type="component" />
                    <jdoc:include type="modules" name="position-2" style="none" />
                    <!-- End Content -->
                </main>