Shape 5

Joomla Templates => Business Look - November 07 - Club => : barsik01 October 01, 2009, 06:10:25 PM



: HTML not generating correctly when no left and right modules displayed
: barsik01 October 01, 2009, 06:10:25 PM
In my website there are a couple of pages that display at full width without modules placed on the left or the right.  In those instances, the HTML generated for the page creates a tag and drops off in the middle before completing:

<div id="s5_mainbackmiddle">
<div style="
<div id="s5_maincolumn" style="width:888px;float:left;">

As a results I'm seeing some strange behavior:

http://lts-allies.org/index.php/forums

The relevant code appears to start around line 306-307 in the index.php file, but I don't speak PHP   :D

Thanks.


: Re: HTML not generating correctly when no left and right modules displayed
: barsik01 October 01, 2009, 06:36:54 PM
Followup:  I was able to add a </div> tag to the inserted center module in the page I sent (http://lts-allies.org/index.php/forums) so that the visual is fixed.  But the incomplete div tag after s5_mainbackmiddle is still in the HTML.

Thanks!


: Re: HTML not generating correctly when no left and right modules displayed
: jonahh October 01, 2009, 07:10:32 PM
Where do you see the extra DIV, just in the php file?  Have you tried just removing it?


: Re: HTML not generating correctly when no left and right modules displayed
: barsik01 October 01, 2009, 07:24:01 PM
It's here (lines 306-311 in index.php):

                     <div style="
                     <?php if ($this->countModules("left") && !$this->countModules("right")) { ?>margin-left:<?php echo $left_margin; ?>px;"><?php } ?>
               
                     <?php if (!$this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;"><?php } ?>

                     <?php if ($this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;margin-left:<?php echo $left_margin; ?>px;"><?php } ?>

And it produces the following code:

                     <div style="
                                    
                     
                                    <div id="s5_maincolumn" style="width:888px;float:left;">

The DIV tag however renders properly if either a left or right module is on in a page, so I don't know that it should be removed?



: Re: HTML not generating correctly when no left and right modules displayed
: jonahh October 05, 2009, 02:46:22 PM
Try changing it to the following, I've added a fourth line if no left or right modules are published:

<div style="
                     <?php if ($this->countModules("left") && !$this->countModules("right")) { ?>margin-left:<?php echo $left_margin; ?>px;"><?php } ?>
               
                <?php if (!$this->countModules("left") && !$this->countModules("right")) { ?>margin-left:<?php echo $left_margin; ?>px;"><?php } ?>
               
                     <?php if (!$this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;"><?php } ?>

                     <?php if ($this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;margin-left:<?php echo $left_margin; ?>px;"><?php } ?>


: Re: HTML not generating correctly when no left and right modules displayed
: barsik01 October 05, 2009, 08:32:23 PM
Thanks, Jonah.

Unfortunately it did not work. I'm attaching a screenshot of a page that includes no left/right modules.  If it would help, I can PM you login credentials to take a look.

Bryce


: Re: HTML not generating correctly when no left and right modules displayed
: barsik01 October 06, 2009, 08:12:59 PM
This is what I did...
I changed your code to read:
<div style="
                     <?php if ($this->countModules("left") && !$this->countModules("right")) { ?>margin-left:<?php echo $left_margin; ?>px;"><?php } ?>
               
                     <?php if (!$this->countModules("left") && !$this->countModules("right")) { ?>margin-left:0px;"><?php } ?>
               
                     <?php if (!$this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;"><?php } ?>

                     <?php if ($this->countModules("left") && $this->countModules("right")) { ?>margin-right:<?php echo $right_margin; ?>px;margin-left:<?php echo $left_margin; ?>px;"><?php } ?>


Then, just before the <div id="s5_mainbottomback"></div> I added this code to close off the DIV tag that was left open:

                     <?php if (!$this->countModules("left") && !$this->countModules("right")) { ?></div><?php } ?>

It appears to be working...   :)