• Resolved skirkster

    (@skirkster)


    Hi,

    I have my theme set up to use images in text widgets as links to categories. Whenever any of these links are clicked, my page redraws the right sidebar below everything else (for a second time) at the full width of the page, extending itself over the page’s surrounding border. The exact same thing also happens whenever I search for anything. I’m sure this is a PHP coding error, but I’m still relatively new to that, so if anyone could help me at all, I’d greatly appreciate it. The page is over at blog.noelmarie.com; you’ll see what happens when you click those links or try to search. If you need more information, sidebar code, etc. please let me know, as I need to get this resolved as quickly as possible. Thanks so much to anyone who can help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    What you are seeing is your theme’s 404 page – page not found. Are there any posts in those categories your buttons represent? If not, that is how WP handles a category with no posts. Put a dummy post in each category and your results may be different.

    As far as the sidebar extended out of the contents area,this is the page validator link for your page not found error message page
    http://validator.w3.org/check?uri=http://blog.noelmarie.com/?cat=5

    It shows a number of div’s with missing or unmatched closing div’s. You need to clean up your code to resolve that issue. You have many many div’s in your design and it makes it hard to follow what is going on.

    Thread Starter skirkster

    (@skirkster)

    Thank you so much. I had a feeling that the code was a little too messy. Thanks for the quick answer!

    Thread Starter skirkster

    (@skirkster)

    Hello again,

    I’ve been trying to clean up my code (which all of it needed) but frankly, I’m not too well versed in PHP, and I wasn’t sure if the above sidebar problem would be fixed in my stylesheet, or in the individual PHP files themselves. Please let me know if there’s any specific code I should submit to help.

    Thanks again!

    Hi

    It may need to be cleaned up in both the PHP files and the stylesheet.

    I see one thing now, on your 404 page (should be a template file for 404.php.) The right sidebar is included twice. That is why there is a search box and a wide aplomb films area at the body as well as in the right sidebar. That will have something to do with the left sidebar problem. The ones at the bottom look like they are being inserted after some DIV’s have closed which is why they are horizontal not vertical like the sidebar. There are validator errors about the search box ID being declared twice, also.

    Did you ever check to see if there is at least one post in each catgeory represented by the left sidebar image buttons? The error seems to be on your 404 page only. Adding those posts may make the 404 errors go away. (Obviously the 404 page should be cleaned up anyway).

    Thread Starter skirkster

    (@skirkster)

    The weird thing is that there’s only one call to the right sidebar (search, aplomb) in the 404.php template file. I checked over all my php files, at least, and any div tags that don’t match up just cause more errors after removal. I haven’t finished checking the stylesheet yet, so maybe that’s it.

    I did set a post to the Interior Design category to see if that was the problem, but it still draws the sidebar like before.

    For example: In my Main Index Template (index.php), the div tags for “contentlayout” and “content” were left open. The same ones are open in my Page Template (page.php) as well as Single Post (single.php). The header has no closing div tags for “PageBackgroundGradient”, “Main”, “Sheet”, and “Sheet-body”. The footer has four (yes, four) closing div tags without openers. Now, I’m not sure exactly how it works, but maybe the opening tags for those are contained in an other PHP file? Anyway, if you need to see any of the code, just let me know. I tried fixing the div tags in Index, Page, and Single, and it just messed with my borders.

    Thanks again, you’re a lifesaver!

    Hi

    The way to think about it is the full HTML text of the page consists of the combination of the header file, the footer file, the sidebar file (if a sidebar is being displayed) and the content file – WP uses a different content file in different circumstances. The sum of all the code in all those PHP files, combined, is served up to your web browser by the webserver in the form of a single HTML file.

    When you look at it that way you can realize that tags in the header like BODY and HTML and any overall wrapper DIV’s can’t be closed in the header since they extend down to the footer – thus there are closing tags in the footer that didn’t open in the footer.

    I always mark my closing div tags like this
    </div><!-- end id="content" -->
    since it makes it real simple to know what I am looking at.

    If you are on a PC not a Mac, download and install the free text editor notepad++. Then do a View Source on the browser View menu, and copy the entire sourcecode, and paste it into an empty notepad++ html page. The reason for notepad++ is, as a programmers editor, it comes with color syntax highlighting. One of the things it does is visually display matching and mismatched opening and closing tags. This makes it real easy to see what goes with what. There will be editors with similar features on the Mac, I just don’t know offhand of free ones other than Text Wrangler – not sure if free Text Wrangler does the color syntax matching. At any rate, get a software tool – you will spend hours trying to do the matching by hand. I discovered a better page validator last night, called http://www.totalvalidator.com/index.html that displays the error messages at the point in the sourcecode where they are occurring – much more useful.

    as far as double sidebar – see if your footer.php perhaps is calling in a sidebar? not a good place to do it, i would say.

    wish you the best with this – its quite an education

    Thread Starter skirkster

    (@skirkster)

    Thanks for all the info. It is quite an education, indeed. I’ve been trying to move code around here and there, but I’m having no luck at all. Validation always confuses me when working with PHP, and closing div tags hasn’t been helping much. I’m pretty sure, at this point, that the problem is in either the Main Index Template, Search Results, or Footer. Here’s the code, if it gives you any ideas:

    Main Index:

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div>
    <div class="content">
    
    <div class="Block">
      <div class="Block-body">
    
    <div class="BlockContent">
      <div class="BlockContent-body">
      <?php if (have_posts()) : ?>
    
        <?php while (have_posts()) : the_post(); ?>
    
          <div class="post" id="post-<?php the_ID(); ?>">
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
    
            <div class="entry">
              <?php the_content('Read the rest of this entry &raquo;'); ?>
            </div>
    
            <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
          </div>
    
        <?php endwhile; ?>
    
        <div class="navigation">
          <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
          <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
        </div>
    
      <?php else : ?>
    
        <h2 class="center">Not Found</h2>
        <p class="center">Sorry, but you are looking for something that isn't here.</p>
    
      <?php endif; ?>
    
      </div>
    
    </div>
    
      </div>
    
    </div>
    
    <?php get_footer(); ?>

    Search:

    <?php get_header(); ?>
    <div class="contentLayout">
    <div class="sidebar1">
    
    					<?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    
    </div>
    <div class="content">
    
    <div class="Block">
      <div class="Block-body">
    
    <div class="BlockHeader">
    Search Results
      <div class="l"></div>
      <div class="r"><div></div></div>
    </div>
    
    <div class="BlockContent">
      <div class="BlockContent-body">
    
    <?php if (have_posts()) : ?>
    	<div class="navigation">
    		<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    		<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    	</div>
    	<?php while (have_posts()) : the_post(); ?>
    		<div class="post">
    			<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    			<small><?php the_time('l, F jS, Y') ?></small>
    			<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    		</div>
    	<?php endwhile; ?>
    	<div class="navigation">
    		<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    		<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    	</div>
    <?php else : ?>
    	<h2 class="center">No posts found. Try a different search?</h2>
    <?php endif; ?>
    
      </div>
      <div class="BlockContent-tl"></div>
      <div class="BlockContent-tr"><div></div></div>
      <div class="BlockContent-bl"><div></div></div>
      <div class="BlockContent-br"><div></div></div>
      <div class="BlockContent-tc"><div></div></div>
      <div class="BlockContent-bc"><div></div></div>
      <div class="BlockContent-cl"><div></div></div>
      <div class="BlockContent-cr"><div></div></div>
      <div class="BlockContent-cc"></div>
    </div>
    
      </div>
    </div>
    
    </div>
    
    </div>
    
    <?php get_footer(); ?>

    and Footer:

    </div>
    <div class="sidebar2">
    
    					<?php include (TEMPLATEPATH . '/sidebar2.php'); ?>
    
    </div>
    
    </div>
      </div>
      <div class="Sheet-tl"></div>
      <div class="Sheet-tr"><div></div></div>
      <div class="Sheet-bl"><div></div></div>
      <div class="Sheet-br"><div></div></div>
      <div class="Sheet-tc"><div></div></div>
      <div class="Sheet-bc"><div></div></div>
      <div class="Sheet-cl"><div></div></div>
      <div class="Sheet-cr"><div></div></div>
      <div class="Sheet-cc"></div>
    </div>
    
    <div id="footer">
    <!-- If you'd like to support WordPress, having the "powered by" link somewhere on your blog is the best way; it's our only promotion or advertising. -->
    <p>Designed by CVB.<br />
    <a href="<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a> and <a href="<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.
    <!-- <?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds. --></p>
    </div>
    </div>
    </div>
    <?php wp_footer(); ?>
    
    </body>
    </html>

    Sorry if I’m taking up all your time here; this is just the first theme I’ve worked on, and it’s all going live next Monday, so panic time is starting to set in. Anyway, I really appreciate all you’ve done so far, and thanks in advance if you can help me any more.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘PHP and layout trouble’ is closed to new replies.