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