干草大家帮忙一点帮助。
在我的电影页面上,我可以按 4 件事对电影进行排序,但一次只能排序 1 个
ABC
Date Added
Imdb Ratings
Year
但我试图做的是一次按 2 件事对电影进行排序 Year 和 Imdb Ratings 但它不起作用。
您能否检查导致错误的原因
这是公共功能代码
public function getRealMovies($lang=null, $p=null, $l=null, $sortby=null){
$movies = array();
if (($p) && ($l)){
$start = ($p-1)*$l;
$limit = " LIMIT $start,$l";
} else {
$limit = '';
}
if (!$sortby || $sortby=='abc'){
$order = "ORDER BY title ASC";
} elseif ($sortby=='date'){
$order = "ORDER BY date_added DESC";
} elseif ($sortby=='imdb_rating'){
$order = "ORDER BY imdb_rating DESC";
} elseif ($sortby=='year'){
$order = "ORDER BY year DESC";
} elseif ($sortby=='imdb_rating&year'){
$order = "ORDER BY imdb_rating, year DESC";
}
$e = mysql_query("SELECT * FROM movies WHERE id IN (SELECT movie_id FROM movie_embeds) $order $limit") or die(mysql_error());
if (mysql_num_rows($e)>0){
$ids = array();
while($s = mysql_fetch_array($e)){
$movies[$s['id']] = $this->formatMovieData($s, $lang);
$ids[] = $s['id'];
}
if (count($ids)){
$flags = $this->getFlags($ids);
if (count($flags)){
foreach($movies as $movie_id => $val){
if (array_key_exists($movie_id,$flags)){
$movies[$movie_id]['languages'] = $flags[$movie_id];
} else {
$movies[$movie_id]['languages'] = array();
}
}
}
}
}
return $movies;
}
这是重写角色
RewriteRule ^/?movies/(\d+)$ index.php?menu=movies&p=$1&sortby=abc&lang=en [L]
RewriteRule ^/?movies/abc/(\d+)$ index.php?menu=movies&p=$1&sortby=abc&lang=en [L]
RewriteRule ^/?movies/date/(\d+)$ index.php?menu=movies&p=$1&sortby=date&lang=en [L]
RewriteRule ^/?movies/imdb_rating/(\d+)$ index.php?menu=movies&p=$1&sortby=imdb_rating&lang=en
RewriteRule ^/?movies/year/(\d+)$ index.php?menu=movies&p=$1&sortby=year&lang=en
RewriteRule ^/?movies/date index.php?menu=movies&sortby=date&lang=en
RewriteRule ^/?movies/abc index.php?menu=movies&sortby=abc&lang=en
RewriteRule ^/?movies/imdb_rating index.php?menu=movies&sortby=imdb_rating&lang=en
RewriteRule ^/?movies/year index.php?menu=movies&sortby=year&lang=en
RewriteRule ^/?movies/fav index.php?menu=movies&sortby=imdb_rating&year&lang=en
RewriteRule ^/?movies index.php?menu=movies&lang=en [L]
RewriteRule ^/?requests index.php?menu=requests&lang=en [L]
这是按钮
<li{if $sortby eq 'abc'} class="current"{/if}><a href="{$baseurl}/{$routes.movies}/abc">{$lang.sorting_abc}</a></li>
<li{if $sortby eq 'date'} class="current"{/if}><a href="{$baseurl}/{$routes.movies}/date">{$lang.sorting_newest}</a></li>
<li{if $sortby eq 'imdb_rating'} class="current"{/if}><a href="{$baseurl}/{$routes.movies}/imdb_rating">{$lang.sorting_imdb}</a></li>
<li{if $sortby eq 'year'} class="current"{/if}><a href="{$baseurl}/{$routes.movies}/year">{$lang.released}</a></li>
<li{if $sortby eq 'imdb_rating&year'} class="current"{/if}><a href="{$baseurl}/{$routes.movies}/imdb_rating&year">Fav</a></li>
{else}
<li{if $sortby eq 'abc'} class="current"{/if}><a href="{$baseurl}/index.php?menu=movies&sortby=abc">{$lang.sorting_abc}</a></li>
<li{if $sortby eq 'date'} class="current"{/if}><a href="{$baseurl}/index.php?menu=movies&sortby=date">{$lang.sorting_newest}</a></li>
<li{if $sortby eq 'imdb_rating'} class="current"{/if}><a href="{$baseurl}/index.php?menu=movies&sortby=imdb_rating">{$lang.sorting_imdb}</a></li>
<li{if $sortby eq 'year'} class="current"{/if}><a href="{$baseurl}/index.php?menu=movies&sortby=year">{$lang.released}</a></li>
<li{if $sortby eq 'imdb_rating&year'} class="current"{/if}><a href="{$baseurl}/index.php?menu=movies&sortby=imdb_rating&year">Fav</a></li>
任何人都可以帮忙吗
谢谢 :)