Prev | Current Page 41 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

Therefore, a call to http://zfia.example.com/ will result in the ???index???
action of the Index controller running. Similarly, a call to http://zfia.example.com/test will results in the index
action of the test controller running. As we will discover later, this mapping is very flexible, however the
default covers most scenarios out of the box.
Within the front controller system, the dispatcher expects to find a file called IndexController.php within
the application/controllers directory. This file must contain a class called IndexController and, as a minimum,
this class must contain a function called indexAction(). For our Hello World application, Listing 2.3 shows the
IndexController.php required.
Listing 2.3: The index controller: application/controllers/IndexController.php
Zend::LoadClass('Zend_View');
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$ this->view->assign('title', 'Hello World!'); #1
}
}
(annotation) <#1 Assign the title to the view property.>
As you can see, IndexController is a child class of Zend_Controller_Action which contains the request and
response objects for access within the action functions, along with a few useful helper functions to control the
program flow.


Pages:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
Wczasy nad morzem wyciągarki sklep modelarski Okna PCV Wrocław twarożek ze szczypiorkiem