step 7: controller for posts cakephp blog

step 7: making controller for posts cakephp blog

fire-up your favorite browser to see the effect before creating posts controller "http://localhost/cakeblog/posts" in cakephp blog. Browser output should look like as follows:

 

To solve the problem, make a file “/app/controllers/posts_controller.php" then copy & paste blow code into the file.

/app/controllers/posts_controller.php

   <?php
      class PostsController extends AppController
      {
         var $name = 'Posts';
         function index()
         {
            $this->set('posts', $this->Post->find('all'));
         }
      }
   ?>

Related Tutorial Examples

  1. step 4: database configure for cakephp blog
  2. step 5: making homepage for cakephp blog
  3. step 6: template setup for cakephp blog
  4. step 8: making model for posts cakephp blog
  5. step 9: view for posts cakephp blog cakephp examples
  6. step 10: making view post details for cakephp blog
  7. step 11: admin view posts for cakephp blog
  8. MySQL IFNULL() Nested Function Example
  9. MySQL IFNULL() Function String Example
  10. MySQL IFNULL() Function Number Example

No comments:

Post a Comment

leave your comments here..