本文整理汇总了PHP中Brand::getBrandById方法的典型用法代码示例。如果您正苦于以下问题:PHP Brand::getBrandById方法的具体用法?PHP Brand::getBrandById怎么用?PHP Brand::getBrandById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Brand
的用法示例。
在下文中一共展示了Brand::getBrandById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: htmlentities
<?php
if (isset($_GET['id']) && !empty($_GET['id'])) {
$id = htmlentities($_GET['id']);
$brands = Brand::getBrandById($id);
if (isset($_POST['edit'])) {
if (preg_match("#^[a-zA-Z0-9._-]{2,30}#", $_POST['name'])) {
PDOConnexion::setParameters('phonedeals', 'root', 'root');
$db = PDOConnexion::getInstance();
$sql = "\n\t\t\t\tUPDATE brand\n\t\t\t\tSET name = :name\n\t\t\t\tWHERE id = :id\n\t\t\t";
$sth = $db->prepare($sql);
$sth->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Brand');
$sth->execute(array(':id' => $id, ':name' => $_POST['name']));
if ($sth) {
App::success('Cette marque a bien été modifiée');
}
} else {
App::error("Le nom de cette marque n'est pas valide");
}
}
if ($brands) {
?>
<div class="col-md-8">
<div class="page-header">
<h1>Éditer une marque</h1>
</div>
<form action="index.php?page=admin/brand-edit&id=<?php
echo $id;
?>
" method="POST">
示例2: foreach
<table class="table table-striped">
<thead>
<th>Nom</th>
<th>Marque</th>
<th>Capacité</th>
<th>Prix</th>
<th>Couleur</th>
<th>Description</th>
<th></th>
<th></th>
</thead>
<?php
foreach (Phone::getPhonesList() as $phone) {
echo '<tr data-id="' . $phone->id . '">';
echo '<td><a href="index.php?page=admin/phone-edit&id=' . $phone->id . '">' . $phone->name . '</a></td>';
echo '<td>' . Brand::getBrandById($phone->brand) . '</td>';
echo '<td>' . $phone->capacity . ' Go</td>';
echo '<td>' . $phone->price . ' €</td>';
echo '<td>' . Color::getColorsNames($phone->color, true) . '</td>';
echo '<td style="max-width: 400px;">' . $phone->description . '</td>';
echo '<td><a href="index.php?page=admin/phone-edit&id=' . $phone->id . '"><i class="fa fa-pencil" data-toggle="tooltip" title="Modifier"></i></a></td>';
echo '<td><a href="#" title="Supprimer" data-toggle="tooltip" data-action="delete" title="Supprimer"><i class="fa fa-trash"></i></a></td>';
echo '</tr>';
}
?>
</table>
<a href="index.php?page=admin/add-phone" class="btn btn-primary">Ajouter un téléphone</a>
</div>
<script>
$('[data-action="delete"]').click(function(e) {
示例3:
<div class="container">
<div class="row">
<?php
if (!isset($_GET['id']) || empty($_GET['id'])) {
App::redirect('index.php?page=list');
} else {
$id = $_GET['id'];
$phone = Phone::getPhoneById($id);
$promotion = Promotion::getPromotionByPhoneId($phone->id);
$brand = Brand::getBrandById($phone->brand);
?>
<div class="col-sm-12" style="margin-bottom: 30px;">
<h1 style="margin-bottom: 0;"><?php
echo $phone->name;
?>
</h1>
<span style="color: #bfbfbf; display: block; font-size: 18px;"><?php
echo $brand->name;
?>
</span>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<a href="index.php?page=product&id=<?php
echo $phone->id;
?>
" style="display: inline-block; padding: 15px; border: 1px solid #ededed;">
<img id="phone_img" src="<?php
echo Phone::getPhoneThumbnail($phone->id);
?>
" alt="<?php
echo $phone->name;