core/api/modules/cat/index.php

42 lines
1.8 KiB
PHP
Raw Normal View History

2022-12-11 13:55:49 +05:00
<?php
2023-04-09 19:52:26 +05:00
2023-01-25 14:20:32 +05:00
@mkdir('img/' . $_SESSION['SERVER_NAME'] . '/pages_category', 0700);
$smarty -> assign( 'page_info', \DB::getAll( "SELECT * FROM `pages_category` WHERE `id`=?", $_GET['id'] ) );//получаем инфо о категории
$list= \DB::getAll ( "SELECT * FROM `pages` WHERE `category`=?", $_GET['id'] );
2023-04-09 19:52:26 +05:00
for($i=0; $i<count($list); $i++){
//Берем обложку
$list[$i]['img']=\DB::getValue("SELECT `filename` FROM `pages_img` WHERE `pages_id`=? LIMIT 1", $list[$i]['id']);
//Берем количество коментариев
}
//print_r($list);
2023-01-25 14:20:32 +05:00
$smarty -> assign( 'list', $list );
2022-12-11 13:55:49 +05:00
$smarty -> assign( 'sliders', $sliders );
2023-04-09 19:52:26 +05:00
/* ----------------------------------------------------------------------
01.04.2023
Получаем спиосок категорий страниц
---------------------------------------------------------------------- */
$categories=\DB::getAll("SELECT * FROM `pages_category` ORDER BY `title`");
for ($i=0; $i<count($categories); $i++)$categories[$i]['count']=\DB::getAll("SELECT COUNT(*) FROM `pages` WHERE `category`=? AND `status`=1", $categories[$i]['id'])[0]['COUNT(*)'];
$smarty->assign('categories', $categories);
/* ----------------------------------------------------------------------
02.04.2023
Получаем самое читабельное
---------------------------------------------------------------------- */
$popular_pages=\DB::getAll("SELECT * FROM `pages` WHERE `status`=1 ORDER BY `see` DESC LIMIT 15");
for ($i=0; $i<count($popular_pages); $i++)$popular_pages[$i]['img']=\DB::getValue("SELECT `filename` FROM `pages_img` WHERE `pages_id`=? LIMIT 1", $popular_pages[$i]['id']);
$smarty->assign('popular_pages', $popular_pages);
2022-12-11 13:55:49 +05:00
?>