SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: wayward end div

Hybrid View

  1. #1
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wayward end div

    I'm going nuts trying to find why the end div for "main" does not work right, so as to allow the "site info" div to work correctly. What's wrong is that the site info div is vertical instead of horizontal across the bottom of this page.
    http://test.rockyourchakras.com/cat_prod/47

    However, on this page the same header and footer scripts work ok:
    http://test.rockyourchakras.com/product/158
    (horizontal site info)

    The only difference between these pages is the script between the header and footer, where the divs are nested correctly.
    PHP Code:
    <div id="content">
        <div class="program_cat">
    <?php
        
    //Print category name and description
        
    echo("<h1>".$title."</h1>");
        echo(
    "<p>".$text."</p>");

         
    //Print product URL, name and description
        
    foreach ($prod_results as $prod) { ?>

      <h2><a href='<?php echo BASE_URL?>/product/<?php echo $prod['id_prod']; ?>'><?php echo $prod['name_prod'?></a></h2>

      <?php
      
    echo("<p>".$prod['descrip']."</p>");
      } 
    //end foreach
      
    ?>
      </div><!--end program_cat div -->

    <?php if ($img_cat) {?>
        <div id="right_panel">
        <?php echo( "$img_cat); ?>
        </div><!--end right panel -->
    </div><!--end content -->
    <?php ?>
    What am I missing?
    Paul C.
    ClickBasics
    http://www.clickbasics.com

  2. #2
    @alexstanford Alex's Avatar
    Join Date
    Apr 2004
    Location
    Jacksonville, Florida
    Posts
    759
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paulcj2 View Post
    I'm going nuts trying to find why the end div for "main" does not work right, so as to allow the "site info" div to work correctly. What's wrong is that the site info div is vertical instead of horizontal across the bottom of this page.
    http://test.rockyourchakras.com/cat_prod/47

    However, on this page the same header and footer scripts work ok:
    http://test.rockyourchakras.com/product/158
    (horizontal site info)

    The only difference between these pages is the script between the header and footer, where the divs are nested correctly.
    PHP Code:
    <div id="content">
        <div class="program_cat">
    <?php
        
    //Print category name and description
        
    echo("<h1>".$title."</h1>");
        echo(
    "<p>".$text."</p>");

         
    //Print product URL, name and description
        
    foreach ($prod_results as $prod) { ?>

      <h2><a href='<?php echo BASE_URL?>/product/<?php echo $prod['id_prod']; ?>'><?php echo $prod['name_prod'?></a></h2>

      <?php
      
    echo("<p>".$prod['descrip']."</p>");
      } 
    //end foreach
      
    ?>
      </div><!--end program_cat div -->

    <?php if ($img_cat) {?>
        <div id="right_panel">
        <?php echo( "$img_cat); ?>
        </div><!--end right panel -->
    </div><!--end content -->
    <?php ?>
    What am I missing?
    paulcj2,

    The issue is that the div with an id of "main" is not closed on the page with an issue before the "site info" div is opened.

    The layout of your code should be something like this:
    Code:
    <div id="wrap">
      <div id="main">content</div>
      <div id="site_info">footer</div>
    </div>
    On the broken page you have something like:
    Code:
    <div id="wrap">
      <div id="main">content
      <div id="site_info">footer</div>
      </div>
    </div>
    Alex
    Alex Stanford @alexstanford tumblog about.me in fb G+ K
    TechTalkin The Premier Community for Technology Enthusiasts and Professionals
    Full Ambit Media Zero Sacrifice Web Design & Development; Made in the USA @fullambit in fb G+ K

  3. #3
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paulcj2 View Post
    ...
    What am I missing?
    On that page, the closing tag of the content div is missing.
    Happy ADD/ADHD with Asperger's

  4. #4
    @alexstanford Alex's Avatar
    Join Date
    Apr 2004
    Location
    Jacksonville, Florida
    Posts
    759
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Erik J View Post
    On that page, the closing tag of the content div is missing.
    I'm at work and just breezed over it. I knew that the "main" div had not been closed properly, I assumed he closed it after the footer.

    Nice catch, Erik.

    Alex
    Alex Stanford @alexstanford tumblog about.me in fb G+ K
    TechTalkin The Premier Community for Technology Enthusiasts and Professionals
    Full Ambit Media Zero Sacrifice Web Design & Development; Made in the USA @fullambit in fb G+ K

  5. #5
    Web Enthusiast
    Join Date
    Jul 2000
    Location
    Western Massachusetts, USA
    Posts
    1,366
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    Turns out I had added the end div within a conditional statement. When that did not evaluate to true, the end div did not display. I fixed that, and now life is good.
    Paul C.
    ClickBasics
    http://www.clickbasics.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •