function edit_action($id) { //$post = get_post($id); $postsModel = new PostsModel(); $post = $postsModel->get_post_by_id($id); $html = render_template('view/template/edit.php', array('post' => $post)); return $html; //require "view/template/admin.php"; }
function showpost_action($id) { $postsModel = new PostsModel(); $post = $postsModel->get_post_by_id($id); $html = render_template("View/Templates/showpost.php", array('post' => $post)); //return new Response($html); //require "View/Templates/showpost.php"; return $html; }
function edit_action($id) { $model = new PostsModel(); /*$post = get_post($id);*/ $post = $model->get_post_by_id($id); $html = render_template('View/Templates/edit.php', array('post' => $post)); if (isset($_POST['edit_post'])) { $model->update($id); header("location: ../index.php/show?id=" . $id); } return $html; }