本文整理汇总了PHP中Movie::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Movie::getList方法的具体用法?PHP Movie::getList怎么用?PHP Movie::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Movie
的用法示例。
在下文中一共展示了Movie::getList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
require_once 'header.php';
//$top_movies = array_slice($movies, 0, 8);
//$top_movies = $db->query('SELECT * FROM movies ORDER BY year DESC LIMIT 8')->fetchAll();
//$rand_movies = $db->query('SELECT * FROM movies ORDER BY RAND() LIMIT 3')->fetchAll();
$top_movies = Movie::getList(8, 'year DESC');
$rand_movies = Movie::getList(3, 'RAND()');
?>
<div class="row">
<div class="col-xs-12 col-sm-9">
<div class="jumbotron">
<h1>Bienvenue sur Movies !</h1>
<p>Le site n°1 du cinéma.<br />
Découvrez notre <a href="search.php">recherche</a> de films et des <a href="news.php">actualités</a> sur le cinéma.
</p>
</div><!-- .jumbotron -->
<div class="row marketing">
<?php
foreach ($rand_movies as $key => $movie) {
?>
<!-- BLOCK RANDOM MOVIE -->
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4">
<img class="movie-thumbnail" src="<?php
echo $movie->getCover();
?>
" />
示例2: Movie
if (isset($_GET['iDisplayLength'])) {
$per_page = $_GET['iDisplayLength'];
} else {
$per_page = 50;
}
if ($per_page > 500) {
$per_page = 1;
}
if (isset($_GET['iDisplayStart'])) {
$start = $_GET['iDisplayStart'];
} else {
$start = 0;
}
$movie = new Movie();
if (isset($_GET['sSearch']) && $_GET['sSearch']) {
$movies = $movie->getList(null, $start, $per_page, $sortby, $sortdir, $_GET['sSearch']);
} else {
$movies = $movie->getList(null, $start, $per_page, $sortby, $sortdir);
}
$res = array();
$res['sEcho'] = $echo;
if (isset($_GET['sSearch']) && $_GET['sSearch']) {
$res['iTotalDisplayRecords'] = $movie->getMovieCount($_GET['sSearch']);
} else {
$res['iTotalDisplayRecords'] = $movie->getMovieCount();
}
$res['iTotalRecords'] = count($movies);
$res['aaData'] = array();
if (count($movies)) {
foreach ($movies as $key => $val) {
extract($val);
示例3:
<?php
$top_rating_movies = Movie::getList(5, 'rating DESC', 'id, title');
$most_recent_movies = Movie::getList(5, 'year DESC', 'id, title');
$random_movies = Movie::getList(5, 'RAND()', 'id, title');
$last_news = Movie::_getList($db->query('SELECT news_id as id, news_title as title FROM news ORDER BY news_date DESC LIMIT 5')->fetchAll());
?>
<!-- SIDEBAR -->
<div class="col-xs-6 col-sm-3 sidebar-offcanvas" id="sidebar">
<?php
echo Utils::displayList($top_rating_movies, 'Les 5 films les mieux notés', 'movie.php', 'primary');
echo Utils::displayList($most_recent_movies, 'Les 5 films les plus récents', 'movie.php', 'info');
echo Utils::displayList($random_movies, '5 films au hasard', 'movie.php', 'warning');
echo Utils::displayList($last_news, 'Les dernières actualités', 'article.php');
?>
</div>
<!-- END SIDEBAR -->