Fix empty category error
This commit is contained in:
parent
7e3b4365b1
commit
991f8410c9
@ -116,14 +116,15 @@ class Posts
|
|||||||
$date = new \DateTime();
|
$date = new \DateTime();
|
||||||
$now = $date->format("Y-m-d");
|
$now = $date->format("Y-m-d");
|
||||||
|
|
||||||
$get_categories = $this->model->showAll([
|
$get_categories = $this->model->showAll([], 'kategori');
|
||||||
['status', '=', 1]
|
$categories = [];
|
||||||
], 'kategori');
|
|
||||||
|
|
||||||
if (array_key_exists(0, $get_categories)) {
|
if ($get_categories) {
|
||||||
$categories = $get_categories;
|
if (array_key_exists(0, $get_categories)) {
|
||||||
} else {
|
$categories = $get_categories;
|
||||||
$categories[] = $get_categories;
|
} else {
|
||||||
|
$categories[] = $get_categories;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = Session::get('userid');
|
$user = Session::get('userid');
|
||||||
@ -211,10 +212,12 @@ class Posts
|
|||||||
$categories = [];
|
$categories = [];
|
||||||
$get_categories = $this->model->showAll([], 'kategori');
|
$get_categories = $this->model->showAll([], 'kategori');
|
||||||
|
|
||||||
if (!array_key_exists(0, $get_categories)) {
|
if ($get_categories) {
|
||||||
$categories[] = $get_categories;
|
if (!array_key_exists(0, $get_categories)) {
|
||||||
} else {
|
$categories[] = $get_categories;
|
||||||
$categories = $get_categories;
|
} else {
|
||||||
|
$categories = $get_categories;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
View::render('Data/kategori.html', [
|
View::render('Data/kategori.html', [
|
||||||
|
Loading…
Reference in New Issue
Block a user