All arguments aside from using $html->tag() instead of <tag> ...

I'm a trying to create a table to display photos I'm pulling from the database and something is amiss.

When I was testing this I changed $num_cols to 2 and it ended the row and started a new one after the second col like I expected. I must have inadvertently changed something because now it won't break on the col like I want it to. Any help would be appreciated.

$i = 0; 
$k = 0;
$num_of_cols = 5; 
echo 
$html->tag('table', null, array(
			        'cellspacing' => 0,
				'cellpadding' => 0,
				'border' => 0
				)
	  )
.$html->tag('tr');

echo ($i!= 0 && $i%$num_of_cols == 0)?'</tr><tr>':'';

foreach($photos as $photo)
{
echo $html->tag('td', null, array(
				  'valign' => 'top'
				  )
		)
.$html->tag('img', null, array(
				'src' => Router::url(array(
							   'controller' => 'photos',
							   'action' => 'displayPhotos/'.$photos[$k++]['Photo']['id']
							   )
			                              ),
							   'height' => 90
				)
	   )
.$html->tag('/td');
$i++; 
}

echo $html->tag('/tr')
.$html->tag('/table');

I got it ... :)

this should be inside the loop, duh. echo ($i!= 0 && $i%$num_of_cols == 0)?'</tr><tr>':'';

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.