Make joomla module span multiple columns

安稳与你 提交于 2020-01-06 08:13:04

问题


I've been searching the web and here for an answer to my question, without avail.

My webpages runs on Joomla 1.5 and the frontpage currently has a 3 column/position layout where I can put modules.

However, I would like a module which spans the two rightmost positions, whilst keeping the modules below them in the regular "three-column layout". I.e. this is how I want it to look:

[MODULE][-------MODULE------]

[MODULE][MODULE][MODULE]

[MODULE][MODULE][MODULE]

My guess is that I need to define a new position that spans the two columns. Is that the case? How do I do it if I want to make sure the modules below the new, wider, module are still in their regular layout?

Thanks!


回答1:


It depends on your template. Things on a joomla powered website are placed in positions.

In any case, if that position you want to hide is in a div with a class, say

display: none

And then give the other 2 modules 50% widths and float them left if they're not already.

float: left;
width:50%

You also might want to clear the floats after that (before the 3 column thingy starts), by making a div with a class of clear and clearting the floats:

clear:both;



回答2:


Yep, this can be done in the template, e.g. use countmodules() to see if a position is to be displayed and arrange the positions accordingly, e.g. the following shows how to have a page that can either have one column or two based on if a module is placed into the "right" column. If there is a module in the "right" column then two divs are displayed (css used to size them) and if there is nothing in the right column a full width main column is displayed instead.

<?php if($this->countModules('right')) : ?>
<div id="divMainContent">
    <jdoc:include type="modules" name="user9" style="xhtml" />
    <jdoc:include type="component" />
    <jdoc:include type="modules" name="bottombanner" style="xhtml" />
</div> <!-- end maincontent -->
<div id="divRight">
    <jdoc:include type="modules" name="right" style="xhtml" />
    <jdoc:include type="modules" name="banner" style="xhtml" />
</div>
<?php else: ?>
    <div id="divMainContentWide">
        <div id="divTopWide">
            <jdoc:include type="modules" name="user9" style="xhtml" />
        </div>
    </div>
<?php endif; ?>


来源:https://stackoverflow.com/questions/12264063/make-joomla-module-span-multiple-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!