的Joomla 3取决于toggler显示于相同位置中的不同模块(Joomla 3 Show dif

2019-10-23 22:49发布

还有就是我的问题:

我有一些套环区段。 本节应根据点击触发显示动态内容。 所以如。 通过点击“支持”,应该有一定的联系信息/下载支持工具提供的,在点击“搜索” - 搜索框等。

我的问题是,如果有可能只用一个模块位置或者其各自的触发需要一个位置来解决这个问题?

希望来形容这本无可厚非=)

任何帮助表示赞赏。

谢谢

亚历克斯

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;

所以,我有添加了两个CustomHTML模块到这个位置。

结果

<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>

所以我觉得这是不可能的,只有一个位置ADN应该有许多需要解决。

请纠正我,如果我有错。

UPD2:我错了。 这是可能的,但不仅通过模板 - 也模块铬tempalte应与自己的载体作用被扩展,以使其权利。

Answer 1:

可以这样做。 你有一个单独的类添加到下的每个模块(分配到同一个模块的位置):

Module Settings -> Advanced -> Module Class Suffix

所以,如果你已经添加suff1suff2类,你可以使用切换它们:

 jQuery(document).ready(function() { jQuery("div.suff1, div.suff2").on("click", function() { jQuery(this).parent().children().toggle(); }); }); 
 div { width: 180px; height: 100px; color: white; } div.suff1 { background: orange; display: none; } div.suff2 { background: blue; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div> <div class="suff1">Module 1</div> <div class="suff2">Module 2</div> </div> 



Answer 2:

不知道理解你的问题,但如果您的触发器的菜单项,你可以告诉你的模块只有在选择这些菜单项显示。
进入扩展 - >模块管理器,选择你想要的模块,然后在模块分配选项卡 - >模块分配选择“仅在选定的页面”,然后选择你想要的菜单项。
你可以让在同一位置的模块。 你的模块将显示在仅在指定的菜单项处于活动状态的位置。
HTH



文章来源: Joomla 3 Show different modules on same position depending on toggler