本文整理汇总了PHP中Author::get_authors_by_id_book方法的典型用法代码示例。如果您正苦于以下问题:PHP Author::get_authors_by_id_book方法的具体用法?PHP Author::get_authors_by_id_book怎么用?PHP Author::get_authors_by_id_book使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Author
的用法示例。
在下文中一共展示了Author::get_authors_by_id_book方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: implode
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Каталог книг <?php
echo $title;
?>
</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<?php
echo $_SESSION['msg'];
if (is_object($book) || isset($_GET['id'])) {
$book = Book::get_book($_GET['id']);
echo '<h3>' . $book->get_title() . '</h3>';
echo '<h4>Относится к жанру:</h4>' . implode(', ', Genre::get_genres_by_id_book($book->get_id()));
echo '<h4>Автор:</h4>' . implode(', ', Author::get_authors_by_id_book($book->get_id()));
echo '<h4>Цена:</h4>' . $book->get_price() . ' грн.<hr />';
echo 'Описание: <br />';
echo wordwrap($book->get_description(), 150, '<br />');
echo '<hr />';
echo '<a href="detailed.php?id=' . $book->get_id() . '&form=1">Закакзать эту книгу↵</a>';
}
//Начало формы заказа
if (isset($_GET['form']) && !empty($_GET['form'])) {
?>
<form action="" method="post">
<fieldset style="width: 20%">
<legend style="font-weight: bold">Заказать книгу: <?php
echo $book->get_title();
?>
</legend>
示例2: foreach
<?php
require_once '../inc/functions.php';
require_once '../inc/admin_config.php';
//Начало страницы
$title = 'Adminzone';
require_once '../inc/head.php';
//Админ - Формы
require_once '../inc/admin_forms.php';
//Список книг
echo '<table cellpadding="4">
<tr><td></td><td><b>Название книги</b></td><td style="text-align: center"><b>Жанр</b></td>
<td style="text-align: center"><b>Автор</b></td>
<td><b>Цена, грн.</b></td><td><b>Краткое описание</b></td></tr>';
$i = 1;
if (is_array(Book::get_books())) {
foreach (Book::get_books() as $array_book) {
echo '<tr><td>' . $i . '.</td><td>' . $array_book['title'] . '</td>
<td>' . wordwrap(implode(', ', Genre::get_genres_by_id_book($array_book['id'])), 25, "<br />") . '</td>
<td>' . wordwrap(implode(', ', Author::get_authors_by_id_book($array_book['id'])), 25, "<br />") . '</td>
<td>' . $array_book['price'] . '</td>
<td>' . trim(mb_substr($array_book['description'], 0, 30, 'UTF-8')) . ' <a href="index.php?id=' . $array_book['id'] . '&edit=1">Изменить
</a>/<a href="index.php?id=' . $array_book['id'] . '&edit=2">Удалить</a></td></tr>';
$i++;
}
}
echo '</table>';
?>
<?php
require_once '../inc/bottom.php';
示例3: foreach
$i = 1;
if (is_array(Book::get_books_by_id_author($_POST['author']))) {
foreach (Book::get_books_by_id_author($_POST['author']) as $array_book) {
echo '<tr><td>' . $i . '.</td><td>' . $array_book['title'] . '</td>
<td>' . implode(', ', Genre::get_genres_by_id_book($array_book['id'])) . '</td>
<td>' . implode(', ', Author::get_authors_by_id_book($array_book['id'])) . '</td>
<td>' . $array_book['price'] . '</td>
<td>' . trim(mb_substr($array_book['description'], 0, 30, 'UTF-8')) . '<a href="inc/detailed.php?id=' . $array_book['id'] . '"> >>Подробнее</a></td></tr>';
$i++;
}
}
echo '</table>';
}
} else {
echo '<table cellpadding="4">
<tr><td></td><td><b>Название книги</b></td><td style="text-align: center"><b>Жанр</b></td>
<td style="text-align: center"><b>Автор</b></td>
<td><b>Цена, грн.</b></td><td><b>Краткое описание</b></td></tr>';
$i = 1;
if (is_array(Book::get_books())) {
foreach (Book::get_books() as $array_book) {
echo '<tr><td>' . $i . '.</td><td>' . $array_book['title'] . '</td>
<td>' . implode(', ', Genre::get_genres_by_id_book($array_book['id'])) . '</td>
<td>' . implode(', ', Author::get_authors_by_id_book($array_book['id'])) . '</td>
<td>' . $array_book['price'] . '</td>
<td>' . trim(mb_substr($array_book['description'], 0, 30, 'UTF-8')) . '<a href="inc/detailed.php?id=' . $array_book['id'] . '"> >>Подробнее</a></td></tr>';
$i++;
}
}
echo '</table>';
}
示例4: foreach
<legend style="font-weight: bold">Добавить книгу:</legend>
<table>
<tr><td><label for="title">Название</label></td>
<td><input type="text" id="title" name="title" value="<?php
if (is_object($book)) {
echo $book->get_title();
}
?>
" /></td></tr>
<tr><td>Автор</td>
<td>
<?php
foreach (Author::get_authors() as $id => $name) {
echo '<input type="checkbox" name="author[]" value="' . $id . '" ';
if (is_object($book)) {
if (in_array($name, Author::get_authors_by_id_book($book->get_id()))) {
echo 'checked';
}
}
echo ' />' . $name;
}
?>
</td></tr>
<tr><td>Жанр</td>
<td>
<?php
foreach (Genre::get_genres() as $id => $name) {
echo '<input type="checkbox" name="genre[]" value="' . $id . '" ';
if (is_object($book)) {
if (in_array($name, Genre::get_genres_by_id_book($book->get_id()))) {
echo 'checked';