summaryrefslogtreecommitdiff
path: root/search.php
diff options
context:
space:
mode:
Diffstat (limited to 'search.php')
-rw-r--r--search.php62
1 files changed, 36 insertions, 26 deletions
diff --git a/search.php b/search.php
index 4a838e4..472c508 100644
--- a/search.php
+++ b/search.php
@@ -8,35 +8,45 @@
<body>
<div id="container">
- <?php include_once('music.php');?>
- <?php include_once('header.php');?>
- <?php include_once('titlebar.php');?>
- <?php include_once 'config.php'?>
- <?php
- $type = $_GET['type']; // 'tag', 'name'
- $value = $_GET['value']; // tag id, name
- $page = $_GET['page']; // page从0开始
- ?>
- <div id="search-condition">
- <?php
- $musiclist = null;
- if($type == "tag") {
- echo '<label class="search-hint">Tag : </label>';
- $tag = fetch_tag_by_id($value);
- echo '<label class="search-value">' . $tag->name . "</label>";
- $musiclist = fetch_musics_by_tag($tag->uid, $page * Config::$music_per_page, Config::$music_per_page);
- }
- else if($type == "name") {
- echo '<label class="search-hint">Searching : </label>';
- echo '<label class="search-value">' . $value . "</label>";
+ <div id="container">
+ <?php include_once('music.php');?>
+ <?php include_once('header.php');?>
+ <?php include_once('titlebar.php');?>
+ <?php include_once 'config.php'?>
+ <?php include_once 'functions.php'?>
+ <?php
+ $type = $_GET['type']; // 'tag', 'name'
+ $value = $_GET['value']; // tag id, name
+ $current_page_index = $_GET['page']; // page从0开始
+ ?>
+ <div id="search-condition">
+ <?php
+ $musiclist = null;
+ if($type == "tag") {
+ echo '<label class="search-hint">Tag : </label>';
+ $tag = fetch_tag_by_id($value);
+ echo '<label class="search-value">' . $tag->name . "</label>";
+ $musiclist = fetch_musics_by_tag($tag->uid, $current_page_index * Config::$music_per_page, Config::$music_per_page);
+ $url = "./search.php?type=tag&value=" . $value;
+ $total_page = ceil(get_music_count_by_tag($tag->uid) / Config::$music_per_page);
+ }
+ else if($type == "name") {
+ echo '<label class="search-hint">Searching : </label>';
+ echo '<label class="search-value">' . $value . "</label>";
- $musiclist = fetch_musics_by_name($value, $page * Config::$music_per_page, Config::$music_per_page);
- }
+ $musiclist = fetch_musics_by_name($value, $current_page_index * Config::$music_per_page, Config::$music_per_page);
+ $url = "./search.php?type=name&value=" . $value;
+ $total_page = ceil(get_music_count_by_name($value) / Config::$music_per_page);
+ }
- ?>
+ ?>
+ </div>
+ <?php include_once('musiclist.php');?>
+
</div>
- <?php include_once('musiclist.php');?>
-
+
+ <?php include 'paginate.php' ?>
+
</div>
</body>