Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Module Joomla 3根据切换开关在同一位置显示不同的模块_Module_Joomla3.4 - Fatal编程技术网

Module Joomla 3根据切换开关在同一位置显示不同的模块

Module Joomla 3根据切换开关在同一位置显示不同的模块,module,joomla3.4,Module,Joomla3.4,我的问题是: 我有一些开关部分。本节应根据单击的触发器显示动态内容。因此,例如,单击“支持”,应提供一些联系信息/下载支持工具,单击“搜索”-搜索框等 我的问题是,如果只需要一个模块位置或每个触发器需要一个位置,是否可以解决这个问题 希望能描述这一点(可以理解=) 感谢您的帮助 谢谢 亚历克斯 UPD: 我将尝试用代码解释: 模块位置: if ($this->countModules('pos-1')) : $module = JModuleHelper::getM

我的问题是:

我有一些开关部分。本节应根据单击的触发器显示动态内容。因此,例如,单击“支持”,应提供一些联系信息/下载支持工具,单击“搜索”-搜索框等

我的问题是,如果只需要一个模块位置或每个触发器需要一个位置,是否可以解决这个问题

希望能描述这一点(可以理解=)

感谢您的帮助

谢谢

亚历克斯

UPD: 我将尝试用代码解释:

模块位置

   if ($this->countModules('pos-1')) : 
        $module = JModuleHelper::getModules( 'pos-1' );
        foreach($modules as $m) : ?>
            <section class="mod_%echo $m->title%">
                <jdoc:include type="modules" name="pos-1" style="xhtml" />
            </section>
        endforeach;
    endif;
if ($this->countModules('pos-1')) : 
    $module = JModuleHelper::getModules( 'pos-1' ); 
    foreach($module as $m) :
        <a class="btn-collapse collapsed" role="button" data-toggle="collapse" data-parent="#accordion" 
        href="#echo $m->title;" aria-expanded="true" aria-controls=" echo $m->title;">
            <i class="fa fa-building-o"></i> <? echo $m->title; ?>
        </a>                        
    endforeach;
endif;
<section ... class="mod_title1">
    content mod_one
    content mod_two
</section>
<section ... class="mod_title2">
    content mod_one
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
<section ... class="mod_title1">
    content mod_one
</section>
<section ... class="mod_title2">
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
if($this->countModules('pos-1')):
$module=JModuleHelper::getModules('pos-1');
foreach(模块为$m):?>
endforeach;
endif;
和触发器

   if ($this->countModules('pos-1')) : 
        $module = JModuleHelper::getModules( 'pos-1' );
        foreach($modules as $m) : ?>
            <section class="mod_%echo $m->title%">
                <jdoc:include type="modules" name="pos-1" style="xhtml" />
            </section>
        endforeach;
    endif;
if ($this->countModules('pos-1')) : 
    $module = JModuleHelper::getModules( 'pos-1' ); 
    foreach($module as $m) :
        <a class="btn-collapse collapsed" role="button" data-toggle="collapse" data-parent="#accordion" 
        href="#echo $m->title;" aria-expanded="true" aria-controls=" echo $m->title;">
            <i class="fa fa-building-o"></i> <? echo $m->title; ?>
        </a>                        
    endforeach;
endif;
<section ... class="mod_title1">
    content mod_one
    content mod_two
</section>
<section ... class="mod_title2">
    content mod_one
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
<section ... class="mod_title1">
    content mod_one
</section>
<section ... class="mod_title2">
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
if($this->countModules('pos-1')):
$module=JModuleHelper::getModules('pos-1');
foreach(模块为$m):
endforeach;
endif;
因此,我在这个位置添加了两个CustomHTML模块

结果

   if ($this->countModules('pos-1')) : 
        $module = JModuleHelper::getModules( 'pos-1' );
        foreach($modules as $m) : ?>
            <section class="mod_%echo $m->title%">
                <jdoc:include type="modules" name="pos-1" style="xhtml" />
            </section>
        endforeach;
    endif;
if ($this->countModules('pos-1')) : 
    $module = JModuleHelper::getModules( 'pos-1' ); 
    foreach($module as $m) :
        <a class="btn-collapse collapsed" role="button" data-toggle="collapse" data-parent="#accordion" 
        href="#echo $m->title;" aria-expanded="true" aria-controls=" echo $m->title;">
            <i class="fa fa-building-o"></i> <? echo $m->title; ?>
        </a>                        
    endforeach;
endif;
<section ... class="mod_title1">
    content mod_one
    content mod_two
</section>
<section ... class="mod_title2">
    content mod_one
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
<section ... class="mod_title1">
    content mod_one
</section>
<section ... class="mod_title2">
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>

内容模块1
内容模块二
内容模块1
内容模块二
并且应该是

   if ($this->countModules('pos-1')) : 
        $module = JModuleHelper::getModules( 'pos-1' );
        foreach($modules as $m) : ?>
            <section class="mod_%echo $m->title%">
                <jdoc:include type="modules" name="pos-1" style="xhtml" />
            </section>
        endforeach;
    endif;
if ($this->countModules('pos-1')) : 
    $module = JModuleHelper::getModules( 'pos-1' ); 
    foreach($module as $m) :
        <a class="btn-collapse collapsed" role="button" data-toggle="collapse" data-parent="#accordion" 
        href="#echo $m->title;" aria-expanded="true" aria-controls=" echo $m->title;">
            <i class="fa fa-building-o"></i> <? echo $m->title; ?>
        </a>                        
    endforeach;
endif;
<section ... class="mod_title1">
    content mod_one
    content mod_two
</section>
<section ... class="mod_title2">
    content mod_one
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>
<section ... class="mod_title1">
    content mod_one
</section>
<section ... class="mod_title2">
    content mod_two
</section>

<a ... href="#mod_title1" ...>  mod_title1 </a>
<a ... href="#mod_title2" ...>  mod_title2 </a>

内容模块1
内容模块二
因此,我认为这是不可能的,只有一个立场,并应解决与许多

如果我错了,请纠正我


UPD2:我错了。这是可能的,但不仅仅是通过模板-模块chrome tempalte也应该使用自己的函数进行扩展以正确呈现。

不确定是否理解您的问题,但如果您的触发器是菜单项,您可以告诉您的模块仅在选择这些菜单项时显示。
进入扩展->模块管理器,选择所需的模块,然后在模块分配选项卡->模块分配中选择“仅在所选页面上”,并选择所需的菜单项。
您可以让模块处于相同的位置。只有当指定的菜单项处于活动状态时,您的模块才会显示在该位置。

这是可以做到的。您必须在以下条件下为每个模块(分配到相同模块位置)添加单独的类:

因此,如果您添加了
suff1
suff2
类,您可以使用以下方法切换它们:

jQuery(文档).ready(函数(){
jQuery(“div.suff1,div.suff2”)。在(“单击”,函数()上{
jQuery(this.parent().children().toggle();
});
});
div{
宽度:180px;
高度:100px;
颜色:白色;
}
第1分部{
背景:橙色;
显示:无;
}
第2分部{
背景:蓝色;
}

单元1
单元2

谢谢你的帮助。这似乎是一种方式。不幸的是,我现在要测试。我已经在主题中添加了对我的问题的解释。如果您将所有标题/内容放在一个数组中,然后再显示它们,您可以避免更改模块chrome。