本文整理匯總了PHP中BookQuery::searchQuery方法的典型用法代碼示例。如果您正苦於以下問題:PHP BookQuery::searchQuery方法的具體用法?PHP BookQuery::searchQuery怎麽用?PHP BookQuery::searchQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BookQuery
的用法示例。
在下文中一共展示了BookQuery::searchQuery方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: create_rss
function create_rss($search, $limit)
{
$title = 'uBook';
if ($search) {
$title .= ' - Suche nach "' . $search . '"';
}
$link = WEBDIR;
$desc = 'Neue Angebote bei uBook.';
$lang = 'de-de';
$copyright = 'uBook';
$rss = new RssChannel($title, $link, $desc, $lang, $copyright);
$imageUrl = 'http://ubook.asta-bielefeld.de/ubook_small.gif';
$rss->addImage($imageUrl, $title, $link);
$query = BookQuery::searchQuery($search);
$query .= ' order by created desc';
if ($limit > 0) {
$query .= ' limit ' . $limit;
}
$mysqlResult = mysql_query($query);
while ($book = Book::fromMySql($mysqlResult)) {
$title = $book->get('title');
$desc = 'Neues Buchangebot:' . "\n" . $book->asText();
$desc = nl2br(Parser::text2html($desc));
$id = $link = WEBDIR . 'book.php?id=' . $book->get('id');
$author = 'ubook@asta-bielefeld.de (uBook-Team)';
$date = $book->get('created');
$rss->addItem($id, $title, $desc, $link, $author, $date);
}
return $rss;
}
示例2: createMysqlQuery
/**
* Generates a MySQL select statement.
*
* @param string $searchKey user given search key
* @return MySQL select statement
*/
protected function createMysqlQuery()
{
$searchKey = $this->key->asText();
$option = $this->key->getOption();
$query = BookQuery::searchQuery($searchKey);
if ($option == 'new') {
$query .= ' order by created desc limit 7';
} else {
if ($option == 'random') {
$query .= ' order by rand() limit 7';
} else {
$query .= ' order by author, title, price';
}
}
return $query;
}