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
- step 4: database configure for cakephp blog
- step 5: making homepage for cakephp blog
- step 6: template setup for cakephp blog
- step 8: making model for posts cakephp blog
- step 9: view for posts cakephp blog cakephp examples
- step 10: making view post details for cakephp blog
- step 11: admin view posts for cakephp blog
- MySQL IFNULL() Nested Function Example
- MySQL IFNULL() Function String Example
- MySQL IFNULL() Function Number Example

No comments:
Post a Comment
leave your comments here..