本文整理汇总了PHP中Style::getBeers方法的典型用法代码示例。如果您正苦于以下问题:PHP Style::getBeers方法的具体用法?PHP Style::getBeers怎么用?PHP Style::getBeers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Style
的用法示例。
在下文中一共展示了Style::getBeers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
require_once '../../models/style.php';
?>
<h3><a href="add.php">Add new style</a></h3>
<div class="col-md-8">
<table class="table table-striped">
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>Beers</th>
<th>Actions</th>
</tr>
<?php
$styles = Style::getAll();
foreach ($styles as $style) {
$beers = Style::getBeers($style->id);
echo "<tr>";
echo "<td>{$style->id}</td>";
echo "<td>{$style->name}</td>";
echo "<td>{$style->description}</td>";
echo "<td>" . count($beers) . "</td>";
echo "<td>\n\t\t\t\t\t\t\t\t\t<form action='update.php?id={$style->id}' method='POST'>\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='name' value=\"{$style->name}\">\n\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='description' value=\"{$style->description}\">\n\t\t\t\t\t\t\t\t\t\t<input type='submit' value='Edit' class='btn btn-warning'>\n\t\t\t\t\t\t\t\t\t</form>\n\t\t\t\t\t\t \t\t\t<a href='delete.php?id={$style->id}' class='btn btn-danger'>Delete</a>\n\t\t\t\t\t\t\t \t</td>";
echo "</tr>";
}
?>
</table>
</div>
</div>
</body>
</html>
示例2: foreach
<div class='col-md-3'><img height="150" src="assets/images/ingredients/water.jpg" width="180" /></div>
<div class='col-md-3'><img height="150" src="assets/images/ingredients/malts.jpg" width="180" /></div>
<div class='col-md-3'><img height="150" src="assets/images/ingredients/hops.jpg" width="180" /></div>
<div class='col-md-3'><img height="150" src="assets/images/ingredients/yeasts.jpg" width="180" /></div>
</div>
</div>
<hr>
<h2 class='h2-header' id='tasted'>Already tasted</h2>
<div class='container'>
<ul id='tasted_list'>
<div class='row'>
<?php
$tasted = Style::getAll();
$row = 1;
foreach ($tasted as $style) {
$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']);