
| =$prevpage?> | =$pagelist?> | =$nextpage?> |
require_once('common.inc.php');
$sys_maxpage = 10;
$sys_perpage = 5;
$sys_pageoffset = 3;
$list = "";
if (empty($page)) {
$page = 1;
}
if($keyword==''){
if($tag==''){
if ( $type=='' ){
$sql = "SELECT * FROM `node` where `status` = '1' AND `levelone`='1' AND `type` = 'book' ORDER BY `publishing_date` DESC, `id` DESC";
$tag_levelone = '1';
} else {
$sql = "SELECT * FROM `node` where `status` = '1' AND `levelone`='2' AND `type` = 'book' ORDER BY `publishing_date` DESC, `id` DESC";
$tag_levelone = '2';
}
} else {
$sql = "SELECT * FROM `node` where `status` = '1' AND `type` = 'book' AND `tag` = '".$tag."' ORDER BY `publishing_date` DESC, `id` DESC";
$sql_tag = "SELECT * FROM `tag` where `id` = '".$tag."' LIMIT 0,1";
$row_tag=$db->getrow($sql_tag);
}
} else {
$sql = "SELECT `node`.* FROM `node`
LEFT JOIN `publication` ON `node`.`publisher` = `publication`.`id`
where `node`.`status` = '1' AND `node`.`type` = 'book' AND
( `node`.`title` LIKE '%".$keyword."%' OR `node`.`author` LIKE '%".$keyword."%' OR `node`.`content` LIKE '%".$keyword."%' OR `node`.`isbn` LIKE '%".$keyword."%' OR `publication`.`name` LIKE '%".$keyword."%' )
ORDER BY `node`.`publishing_date` DESC, `node`.`id` DESC";
}
$sql_start_pos = ($page-1) * $sys_perpage;
$sql_limit = " LIMIT ".$sql_start_pos.", ".$sys_perpage;
$rs = $db->query($sql.$sql_limit);
while($row=$db->fetch_array($rs)){
$photo = get_attachment("node",$row['id'],"cover");
if(file_exists("./".$photo["path"].'original/'.$photo["file_name"])){
$img = '';
} else {
if($row['cover']!=0&&$row['cover']!='')
{
$sql_cover = "SELECT * FROM `file_managed` WHERE `fid` = '".$row['cover']."' AND `status` = '1' LIMIT 0,1";
$row_cover = $db->getrow($sql_cover);
if($row_cover['filename']!=''){
if( file_exists('./upload/products/original/'.$row_cover['filename'])){
$img = '
';
} else {
$img = '
';
}
} else {
$img = '
';
}
} else
{
$img = '
';
}
}
$price = str_replace('$','',$row['price']);
$sql_publisher = "SELECT `id`,`name` FROM `publication` where `id` = '".$row['publisher']."' LIMIT 0,1";
$row_publisher=$db->getrow($sql_publisher);
$list .= '
| '.$img.' |
';
if ( $row['levelone'] == '1' ){
$list .= ' '.$row['author'].' ';
}
$list .= '';
if ( $row['levelone'] == '1' ){
$list .= 'HK$ '.$price.' | '.$row['isbn'].' | '.$row['publishing_date'].' ';
} else {
$list .= 'HK$ '.$price.' | '.$row['isbn'].' ';
}
$list .= ' |
';
} else {
$prevpage = '
';
}
//
if ($multipage->getnext() != "") {
$nextpage = '
';
} else {
$nextpage = '
';
}
?>
include("inc_head.php"); ?>

| =$prevpage?> | =$pagelist?> | =$nextpage?> |