Пример #1
0
function add_action()
{
    $postsModel = new PostsModel();
    $postsModel->add_post();
    $posts = $postsModel->get_all_posts();
    $html = render_template("View/Templates/admin.php", array('posts' => $posts));
    //return new Response($html);
    /*require "View/Templates/admin.php";*/
    return $html;
}
function admin_action()
{
    $html = render_template('View/Templates/admin.php', array());
    if (isset($_POST['submit']) && !empty($_POST['add_title'])) {
        $model = new PostsModel();
        $model->add_post();
        /*add_post();*/
        header("location: ../index.php");
    }
    return $html;
}
Пример #3
0
function add_action()
{
    $autor = $_POST['add_autor'];
    $date = date("Y-m-d H:i:s");
    $new_content = $_POST['add_content'];
    $title = $_POST['add_title'];
    $postsModel = new PostsModel();
    $postsModel->add_post($autor, $date, $title, $new_content);
    $posts = $postsModel->get_all_posts();
    $html = render_template('view/template/admin.php', array('posts' => $posts));
    return $html;
    //add_post();
    //$post=get_post($id);
    //require "view/template/list.php";
}