Results 1 to 9 of 9
Thread: Zend Framework Modules
Jun 11, 2008, 08:19 #1
- Join Date
- Mar 2006
- Warwickshire, UK
- 0 Post(s)
- 0 Thread(s)
Zend Framework Modules
I have now been searching the internet high and low for a few weeks in hope of finding the answer I require to my Smarty / Modules problem with Zend. As always if you come to SitePoint you get help unlike others... Please bare with me on this one...
Basically, I am trying to create a module called courses so the end url would beCode:
My application Structure is as follows:
application Configuration Controllers Courses Controllers IndexController.php CourseController.php Smarty Models Zend
$controller = Zend_Controller_Front::getInstance(); $controller->setControllerDirectory(array( 'default' => $config->paths->base . 'include/Controllers', 'courses' => $config->paths->base . 'include/Courses/Controllers' )); $controller->registerPlugin(new CustomControllerAclManager($auth)); $controller->throwExceptions(true); $vr = new Zend_Controller_Action_Helper_ViewRenderer(); $vr->setView(new Templater()); $vr->setViewSuffix('tpl'); Zend_Controller_Action_HelperBroker::addHelper($vr); $router = $controller->getRouter(); $router->addConfig(new Zend_Config_Ini('../include/Configuration/routes.ini', 'routes'), 'routes'); $controller->dispatch();
I have spoken to Mr. Zervass from PHPRiot who's book I'm reading & he told me to add a route:
routes.course.route = "courses/:url/:action/*"
routes.course.defaults.module = courses
routes.course.defaults.controller = course
routes.course.defaults.action = index
Example uses modules as well as controllers and action (effectively adding an extra level of grouping the actions)
This basically means if the "action" parameter is blank then "index" is used.
This class is then declared as:
class Courses_CourseController extends CustomControllerAction
I can understand-ish why it's showing the index/index template and not courses/index.tpl template but nothing I try seems to fix it.
Is it possible to use CourseController.php as the default in the courses folder instead of IndexController.php ref: "routes.course.defaults.controller = course" ? confused
Hoping someone can shed light on this for me....