当前位置: 首页>>代码示例>>PHP>>正文


PHP Style::getBeers方法代码示例

本文整理汇总了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>
开发者ID:k4hun,项目名称:beers-blog-php,代码行数:31,代码来源:index.php

示例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']);
开发者ID:k4hun,项目名称:beers-blog-php,代码行数:31,代码来源:beers.php


注:本文中的Style::getBeers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。