Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85653

joomla: space appears if module is not there

The below code will be displayed only if user1 module is enabled

<?php if($this->countModules('user1')) : ?>
<div id="ja-main">
<jdoc:include type="modules" name="user1" />
</div>
<?php endif; ?>

All things are going exactly right. But the key problem is: there shows heighty space if the user1 module is disabled. That means the div is still able to script. Why is this so? How can I remove that space?

Upvotes: 0

Views: 104

Answers (5)

Nitish Thakrar
Nitish Thakrar

Reputation: 515

<?php if($this->countModules('user1')) : ?> <div id="ja-main"> <jdoc:include type="modules" name="user1" /> </div> <?php else if($this->countModules('user1')):?> <div style="display: block;"> /* Content */ </div> <?php endif; ?>

Upvotes: 0

Daniel
Daniel

Reputation: 598

<?php if($this->countModules('user1')>0) : ?>
<div id="ja-main">
<jdoc:include type="modules" name="user1" />
</div>
<?php endif; ?>
<?php if($this->countModules('user1')<1) : ?>
<div style="display: block;"></div>
<?php endif; ?>

The display should be block

Upvotes: 0

Navin Rauniyar
Navin Rauniyar

Reputation: 10555

Try this:

<?php if($this->countModules('user1')>0) : ?>
<div id="ja-main">
<jdoc:include type="modules" name="user1" />
</div>
<?php endif; ?>
<?php if($this->countModules('user1')<1) : ?>
<div style="display: none;"></div>
<?php endif; ?>

Upvotes: 0

haz0rd
haz0rd

Reputation: 270

Sounds like there is still a div laying around that has a specified height. You need to identify that div and make sure that doesn't show up if there is no user module.

Can you use some sort of inspect element in your browsers tool kit (chrome has a nice one) and tell us what div is still lingering around?

Upvotes: 0

shairya
shairya

Reputation: 183

Check if parent div also need to be within 'if' condition. You can also try:

if($this->countModules('user1')>0)

Upvotes: 1

Related Questions