background images showing even when no module

background images showing even when no module was created by Boradan

Posted 8 years 7 months ago #29368
Running into a problem here.

I have a Wrapper called 'feature'.
Inside this wrapper is an 'aligned modules' set with 2 available positions: 'feature-a' and 'feature-b'
The wrapper has a 'page background' applied to it.
It also has a '#feature::before' and a '#feature::after' image applied to it in the custom.css file.

The issue is, that if there are no modules in positions 'feature-a' or 'feature-b', the div still gets created with the background images and no content.

Is it possible to add something to the index.php along the lines of:

If feature-a + feature-b =0, then do nothing, else
<div id ="feature"> etc...
by Boradan

Please Log in or Create an account to join the conversation.

Replied by Boradan on topic background images showing even when no module

Posted 8 years 7 months ago #29369
Cant believe it took me 2 minutes to fix this...
It seems that it is an actual flaw in the way template creator does the coding.

The code was as follows for the wrapper in question::
Code:
<div id="feature"> <div class="container-fluid inner ui-sortable"> <?php if ($nbmodules7) : ?> <section id="modules1"> <div class="inner clearfix <?php echo 'n'.$nbmodules7 ?>"> <?php if ($this->countModules('feature-a')) : ?> <div id="modules1mod1" class="flexiblemodule "> <div class="inner clearfix"> <jdoc:include type="modules" name="feature-a" style="xhtml" /> </div> </div> <?php endif; ?> <?php if ($this->countModules('feature-b')) : ?> <div id="modules1mod2" class="flexiblemodule "> <div class="inner clearfix"> <jdoc:include type="modules" name="feature-b" style="xhtml" /> </div> </div> <?php endif; ?> <div class="clr"></div> </div> </section> <?php endif; ?> </div> </div>


you will notice that the div is actually created before you have the
Code:
<?php if ($nbmodules7) : ?>


This means that the div will ALWAYS be created, even if there are no modules in that position, and this will insert any background images and spacings, regardless of the number of modules.

If you change the code to the following, then the div will ONLY be created if there are modules within that div.

Code:
<?php if ($nbmodules7) : ?> <div id="feature"> <div class="container-fluid inner ui-sortable"> <section id="modules1"> <div class="inner clearfix <?php echo 'n'.$nbmodules7 ?>"> <?php if ($this->countModules('feature-a')) : ?> <div id="modules1mod1" class="flexiblemodule "> <div class="inner clearfix"> <jdoc:include type="modules" name="feature-a" style="xhtml" /> </div> </div> <?php endif; ?> <?php if ($this->countModules('feature-b')) : ?> <div id="modules1mod2" class="flexiblemodule "> <div class="inner clearfix"> <jdoc:include type="modules" name="feature-b" style="xhtml" /> </div> </div> <?php endif; ?> <div class="clr"></div> </div> </section> </div> </div> <?php endif; ?>

You can see that the '<?php if ($nbmodules7) : ?>' and '<?php endif; ?>' have been moved to wrap AROUND the' <div id="feature">.... </div>'

Not only will this fix the issue, but it will probably also make page loads slightly faster as there will be no unnecessary creation of empty divs/wrappers.


Any chance of getting this recoding built into template creator as I think it is a major issue that should be sorted as soon as possible.
by Boradan
The following user(s) said Thank You: ced1870

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic background images showing even when no module

Posted 8 years 7 months ago #29375
Hi
thank you for reporting this problem. I have noted this and I will check this. If you are right it will be fixed :)
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Replied by Boradan on topic background images showing even when no module

Posted 8 years 7 months ago #29404
You can see the fix in action here:
www.templates.computersystems.ie

Use the template selector popout on the left of the screen switch to the last template in the list (wow_legion_video_fullscreen).

The Home page is created normally, but if you click on the forum link, you will see that the forum page creates the empty divs on top of the forum when there are no modules published in those positions on that page - this is the way Template-creator currently works

Now use the template selector on the left to pick the 'wow_legion_video' template (second last on the list).
On the forum page you can see the divs are not created due to my moving the <?php if ($nbmodules7) : ?> in the index.php file
by Boradan

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic background images showing even when no module

Posted 8 years 7 months ago #29443
Hi
I will work on this in the next days and I will come back to you :)
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic background images showing even when no module

Posted 8 years 7 months ago #29454
I have checked your request by my side, and yes I see now. The wrapper has no condition, that's right. In your example the fix is simple because you have only one type of block in it. But imagine a wrapper that has many blocks in it, I can not image putting a condition for all of them...

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Time to create page: 0.742 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 719 guests and no members online