Jump to content

Want to remove block of php code but get unexpected end of file error


Recommended Posts

Hi

 

By the the way the server this site is hosted on is flipping fast!

I'm still a php beginner.

 

I have a php file, the entire code is here:

<?php get_header(); ?>

    <?php if(!is_paged()) { ?>

    <div id="top" class="clearfloat">
    
        <div id="headline">
        
        <?php if ( function_exists('show_nivo_slider') ) { show_nivo_slider(); } ?> 
        </div>
        
    <div id="featured">
    <?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar( ) : ?>
<?php endif; ?>
    </div>
</div>    
    <div id="middle" class="clearfloat">
    <?php $display_categories = array(7, 13, 17, 18, 1528); $i = 1;
    foreach ($display_categories as $category) { ?>

    <div id="cat-<?php echo $i; ?>" class="category">
        <?php query_posts("showposts=1&cat=$category")?>
        <span class="cat_title"><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span>
        <a href="<?php echo get_category_link($category);?>"></a>
    </div>

    <?php $i++; ?>
        <?php } ?>

    </div>

    <?php } ?>
    
    <div id="bottom" class="clearfloat">
    <div id="front-list">    
    
    <?php
      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
      query_posts("cat=-27,-28&paged=$page&posts_per_page=10"); ?>
    
    <?php while (have_posts()) : the_post(); ?>        

    <div class="clearfloat">
    <h3 class=cat_title><?php the_category(', '); ?> &raquo</h3>
    <div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
    <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>    
    
    <div class="spoiler">
    <?php    $values = get_post_custom_values("Image");
    if (isset($values[0])) { ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=150&h=150&zc=1&q=100"
alt="<?php the_title(); ?>" class="left" width="150px" height="150px"  /></a>
      <?php } ?>

    <?php the_excerpt(); ?>
    </div>

    </div>
        
      <?php endwhile; ?>

    <div class="navigation">
        <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } 
            else { ?>

            <div class="right"><?php next_posts_link('Next Page »') ?></div>
            <div class="left"><?php previous_posts_link('« Previous Page') ?></div>
            <?php } ?>

    </div>
    
    </div>
        

    <?php get_sidebar(); ?>

    </div>    

<?php get_footer(); ?>

 

I want to remove the following block on line 19 to 33 because I don't need it:

    <?php $display_categories = array(7, 13, 17, 18, 1528); $i = 1;
    foreach ($display_categories as $category) { ?>

    <div id="cat-<?php echo $i; ?>" class="category">
        <?php query_posts("showposts=1&cat=$category")?>
        <span class="cat_title"><a href="<?php echo get_category_link($category);?>"><?php single_cat_title(); ?></a></span>
        <a href="<?php echo get_category_link($category);?>"></a>
    </div>

    <?php $i++; ?>
        <?php } ?>

    </div>

    <?php } ?>

 

But when I remove that I get the error, unexpected end of file error and references to <?php get_footer(); ?>

 

I need to understand why this is happening, not just how to fix it (although I need that too).  My suspicion is one of the endif's.

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.