$beers = count(Style::getBeers($style->id)); echo "<div class='col-md-4'>\n\t\t\t\t\t\t\t<li><a href='" . $_SERVER['PHP_SELF'] . "?style=" . $style->id . "#tasted'>" . $style->name . "</a> <span class='badge'>" . $beers . "</span></li>\n\t\t\t\t\t\t</div>"; if ($row % 3 == 0) { echo "</div><div class='row'>"; } $row++; } ?> </div> </ul> <div class='row'> <?php $beers = Beer::getAll(); if (isset($_GET['style'])) { $beers = Beer::getByStyle($_GET['style']); } $row = 1; foreach ($beers as $beer) { $style = Beer::getStyle($beer->style_id); $brewery = Beer::getBrewery($beer->brewery_id); echo "<div class='col-md-4'>\n\t\t\t\t\t\t<div class='thumbnail'>\n\t\t\t\t\t\t\t<img class='img-thumbnail' height='600' src='uploads/{$beer->photo_url}' width='450'/>\n\t\t\t\t\t\t\t<div class='caption'>\n\t\t\t\t\t\t\t\t<h3>{$beer->name}</h3>\n\t\t\t\t\t\t\t\t<h4>{$style->name} from {$brewery->name}</h4>\n\t\t\t\t\t\t\t\t<p>Rating: "; for ($i = 0; $i < $beer->rating; $i++) { echo "<img src='assets/images/rate_star.png' height='20' width='20'/>"; } echo "</p>\n\t\t\t\t\t\t\t\t<p>{$beer->description}</p>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>"; if ($row % 3 == 0) { echo "</div><div class='row'>"; } $row++; }