前言:
此修改的前提是, 您必須已經安裝下列兩個外掛, 而且運作正常.
// 相簿藝廊
http://smartor.is-root.com/viewtopic.php?t=3021
// 相簿藝廊 (附加外掛) 圖片搜尋
http://www.ekopapers.com/progr/searchalbum.rar
修改:
#
#-----[ OPEN ]-----
#
album_search.php
#
#-----[ FIND ]-----
#
代碼: 選擇全部
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_approval, c.cat_id, c.cat_title
#
#-----[ BEFORE, ADD ]-----
#
代碼: 選擇全部
// + 分頁
$pics_per_page = 10;// 設定每頁顯示的圖片數量
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$order_by = "p.pic_time DESC LIMIT $start, " . $pics_per_page;
$count_sql = "SELECT COUNT(pic_id) AS count
FROM " . ALBUM_TABLE . ' AS p,' . ALBUM_CAT_TABLE . " AS c
WHERE p.pic_approval = 1 AND " . $where . " LIKE '%" . $s . "%' AND p.pic_cat_id = c.cat_id OR p.pic_cat_id = 0 AND p.pic_approval = 1 AND " . $where . " LIKE '%" . $s . "%'";
if( !($result = $db->sql_query($count_sql)) )
{
message_die(GENERAL_ERROR, '無法統計圖片數量', __LINE__, __FILE__, $count_sql);
}
$row = $db->sql_fetchrow($result);
$total_pics = $row['count'];
$pagination = generate_pagination("album_search." . $phpEx . "?mode=" . $m . "&search=" . $s, $total_pics, $pics_per_page, $start);
// - 分頁
#
#-----[ FIND ]-----
#
代碼: 選擇全部
ORDER BY p.pic_time DESC";
#
#-----[ REPLACE WITH ]-----
#
代碼: 選擇全部
ORDER BY $order_by";
#
#-----[ FIND ]-----
#
代碼: 選擇全部
'L_NRESULTS' => $numres,
#
#-----[ REPLACE WITH ]-----
#
代碼: 選擇全部
//'L_NRESULTS' => $numres,
#
#-----[ FIND ]-----
#
代碼: 選擇全部
}
else
{
$template->assign_block_vars('switch_search', array());
}
#
#-----[ AFTER, ADD ]-----
#
代碼: 選擇全部
// + 分頁
$template->assign_vars(array(
'L_NRESULTS' => $total_pics,
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], (floor($start / $pics_per_page) + 1), ceil($total_pics / $pics_per_page))
));
// - 分頁
#
#-----[ OPEN ]-----
#
templates/YOUR_THEME/album_search_body.tpl
#
#-----[ FIND ]-----
#
代碼: 選擇全部
<!-- BEGIN switch_search_results -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td><span class="maintitle">Search found {L_NRESULTS} matches</span><br /></td>
</tr>
<tr>
<td><span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span></td>
</tr>
</table>
#
#-----[ REPLACE WITH ]-----
#
代碼: 選擇全部
<!-- BEGIN switch_search_results -->
<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr>
<td><span class="maintitle">Search found {L_NRESULTS} matches</span><br /></td>
</tr>
<tr>
<td><span class="nav">{PAGE_NUMBER}</span></td>
<td align="right"><span class="nav">{PAGINATION}</span></td>
</tr>
</table>
#
#-----[ SAVE & CLOSE ]-----
#
#End
後記:
目前已知的缺失:
若查詢的關鍵字為
中文的話, 則相關網址會以
亂碼顯示, 導致分頁顯示的連結失效.