• Hey All

    Im trying to create a Loop that sorts the posts in a table with 3 columns.
    My get_post_custom_values is a fuld link to a thumbnail. It works great if i put it in a “normal loop” without the table an foreach looping. So I know it isnt the link thats broking.

    <table border="1"  height="100%">
    <?php
    $posts = get_posts('category_name=cases&showposts=15');
    $postsPerLine = 3;
    $currentPostNumber = 0;
    
    foreach ($posts as $post) :
    	if ($currentPostNumber == 0) {
    		echo '<tr>';    }                        ?>    <td>
    
    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
    
    <img src="<?php echo $values = get_post_custom_values("thumb");?>" alt="<?php the_title(); ?>" class="thumb" />
    
    </a>
    
    <?php the_excerpt(); ?>
    
    </td>
    	<?php
    	$currentPostNumber++;    if ($currentPostNumber >= $postsPerLine) {
    	$currentPostNumber = 0;
    	echo '</tr>';    }  
    
    	endforeach;  ?>
        </table>

    Any ideas??

  • The topic ‘Table in a Loop’ is closed to new replies.