add authors page

This commit is contained in:
Your Name
2021-08-17 00:02:41 +03:00
parent 84d69e8385
commit 7ad83909ff
4 changed files with 130 additions and 15 deletions

View File

@@ -36,22 +36,36 @@ function product_kuri($slug){
}
/**
* категории товаров
*/
function category_kuri($category = '', $filter = 'all', $page = 1){
if ($category == ''){
if (SUBSTATUS == 1){
if (SUBSTATUS == 1){ // категория по умолчанию
$category = 'gazeta';
$filter = "category_id = 1";
}
else {
$category = 'knigi';
$filter = "category_id = 3";
}
}
elseif ($category == 'gazeta') {
$filter = "category_id = 1";
}
elseif ($category == 'knigi') {
$filter = "category_id = 3";
}
$cats = api_cats();
$books = api_books_kuri($category, $filter, $page);
$books = api_books_kuri($filter, $page);
$baseurl = SITE."category/$category/$filter/";
@@ -81,4 +95,54 @@ function category_kuri($category = '', $filter = 'all', $page = 1){
$tempcontent = VIEWPATH.'books.phtml';
include VIEWPATH.'layout.phtml';
}
/**
* книги авторов
*/
function author_kuri($slug, $page = 1){
$find_author_sql = "SELECT * FROM `price_authors` WHERE `authorslug` = '$slug' LIMIT 1";
$find_author = db_get($find_author_sql);
if (!isset($find_author['author_id'])){ # 404
echo 'not fount';
exit;
}
$filter = "`priceauthor_id` = ".$find_author['author_id'];
$books = api_books_kuri($filter, $page);
$baseurl = SITE."author/$slug/";
if ($books['pages'] > 1){
$endurl = $baseurl.$books['pages'];
}
if ($page > 1) {
$pagetitle = $find_author['author'].". Книги - страница $page";
$prevpage = $page - 1 ;
$prevurl = $baseurl.$prevpage;
}
else {
$pagetitle = $find_author['author'].". Книги";
}
if ($page < $books['pages']){
$nextpage = $page+1;
$nexturl = $baseurl.$nextpage;
}
$breadcrumbs['page'] = $pagetitle;
$tempcontent = VIEWPATH.'books.phtml';
include VIEWPATH.'layout.phtml';
}