How to show first 5 post in a loop then break it and continue again

I did some research. It turns out to have something like $postcount = 0; and put $postcount++ in the loop. But I can’t get it working.

Say, I have 4 loops on the page.

The top loop is for a featured category. I have no problem with this loop.

The second loop is what I’m talking about. It’s the main loop (two columns theme) and would show all the posts in descending order. I want to show 5 posts and put a break to it to display ads or some other things then resume to the loop and continue all the way to the last post.

The third and fourth loops are on the sidebar which show popular and video posts respectively.

How do I achieve this?

Thank you,

Here’s what I’m trying to do. Why it’s not working:


<?php
	$postcount = 0;
	if ( have_posts() ) :
		while ( have_posts() ) : the_post();
			if ( $postcount == 0 && $postcount <= 5 ) {
?>
				<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
				<?php 
					the_excerpt();
					$postcount ++;
				?>
<?php 		}
		endwhile;
	endif;
?>

Thanks

OK, do something like this:


<?php
	$postcount = 0;
	if ( have_posts() ) :
		while ( have_posts() ) : the_post();
?>
		<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
		<?php 
			the_excerpt();
			$postcount ++;	
			if ( $postcount == 5 ) {
				echo "Your ad here";
			}
		endwhile;
	endif;
?>