create() public method

creates a new post
public create ( )
<?php

require 'models/' . changesingular($resource) . '.php';
//$post = new Post();
$posts = new PostsController();
switch ($action) {
    case 'index':
        $posts->index();
        break;
    case 'show':
        $posts->show($id);
        break;
    case 'create':
        $posts->create();
        break;
    case 'edit':
        $posts->edit(1);
        break;
    case 'destroy':
        $posts->destroy($id);
        break;
    case 'view':
        $post->view(1);
        break;
    case 'update':
        $post->update(1);
        break;
    case 'delete':
        $post->delete(1);
    default:
        # code...
Beispiel #2
0
<?php

include "../Controllers/PostsController.php";
$controller = new PostsController();
$controller->create();