Fix empty posts error

This commit is contained in:
Gregorio Chiko Putra 2017-09-11 09:05:32 +07:00
parent 70a4c80143
commit aec3b73730

View File

@ -88,6 +88,7 @@ class Posts
$status = 'admin'; $status = 'admin';
} }
if ($post !== false) {
if (array_key_exists(0, $post)) { if (array_key_exists(0, $post)) {
$posts = $post; $posts = $post;
} else { } else {
@ -98,12 +99,11 @@ class Posts
for ($i=0; $i < count($posts); $i++) { for ($i=0; $i < count($posts); $i++) {
$posts[$i]['content'] = preg_replace('/\r\n/', '<br />', $posts[$i]['content']); $posts[$i]['content'] = preg_replace('/\r\n/', '<br />', $posts[$i]['content']);
} }
}
View::render($url, [ View::render($url, [
'posts' => $posts, 'posts' => $posts,
'status' => $status 'status' => $status
]); ]);
die();
} }
public function entry() public function entry()