Recent Topics

1 Oct 29, 2008 23:20    

My b2evolution Version: 2.x

I want to write a skin with the "grid" style (see pic)
http://www.thechristianalert.org/b2evoGrid.jpg

is there a way to loop through the b2evo posts and display them on a row instead of on a list.

Post 1 | Post 2 | Post 3 [these would have excerpts with "read more"] to the full article
.
instead of the traditional list of
Post 1
Post 2
Post 3

I've seen these lines of code

				<?php
					// ---------------------- POST CONTENT INCLUDED HERE ----------------------
					skin_include( '_item_content.inc.php', array(
							'image_size'	=>	'fit-400x320',
						) );
					// Note: You can customize the default item feedback by copying the generic
					// /skins/_item_feedback.inc.php file into the current skin folder.
					// -------------------------- END OF POST CONTENT -------------------------
				?>

But is there a way to customize this to output in a row?

does this make sense?

2 Oct 30, 2008 15:58

// Display message if no post:
display_if_empty();

echo '<table border="0" cellpadding="0" cellspacing="0">';

$nb_cols = 4; // Number of cells in row
$count = 0;
$prev_post_ID = 0;
while( $Item = & mainlist_get_item() )
{
	if( $count % $nb_cols == 0 )
	{
		echo "\n<tr>";
	}
	if( $Item->ID != $prev_post_ID )
	{
		$prev_post_ID = $Item->ID;
		$count++;
	}
		
	echo '<td valign="top">';	
	// =====================		
	
	/* CELL CONTENT GOES HERE */
	
	// =====================	
	echo '</td>';
	if( $count % $nb_cols == 0 )
	{
		echo '</tr>';
	}
}

if( $count && ( $count % $nb_cols != 0 ) )
{
	echo '</tr>';
}
echo '</table>';

Don't include the whole _item_content.inc.php, but open it and copy its parts in the above code. You may want to try this.

// Post title
$Item->title();
// Increment view count of first post on page:
$Item->count_view();
// Display CONTENT:
$Item->content_teaser();
$Item->more_link();

Good luck


Form is loading...