- Download and set up CakePHP in your webroot. Stop reading further if you cant do it or you are not sure how to do it.
- Create a file named “helloworld_controller.php” in folder “cakephp/app/controllers/helloworld_controller.php” and paste following code in the file
<?php
class HelloWorldController extends Controller {
public $name = 'HelloWorld'; //Controller name, we need it.
public $uses=null; //The example doesn't "use" any model.
public $autoRender=false; //Do not render "automagically"
public function index() {//The default action for a CakePHP controller
echo __METHOD__;//This will print HelloWorld suffixed with some more info
}
} - Point your browser to CakePHP installation on your server for example “http://localhost/cakephp/helloworld/”
Piece of cake…


















[...] I just discovered its easy enough to do hello world in CakePHP. Read more [...]
this is an incomplete echo world example
why not using a view? following MVC principles
/views/hello_world/index.ctp
=> put sth to echo
public function index() {} // can stay empty
and I would use an array here:
$var uses = array();
now visit
/hello_world/
thats all…
more correct then the version above.
@mark, agreed to your point. But you still have to create a controller. I know in an MVC framework the purists will insist upon keeping view separate from controller. But as the title says, its simple 3 steps hello world example.