Overriding Default Behaviour
I’ve been playing round with the ZF for a while and wanted to create an app. using it but with a few changes to the default behaviour. The basic requirements are as follows:
• All but a few pages on the site will be handled the same way – but they could have arbitrary URLS
• It is to use Zend_Layout as its master view
• The conventional behaviour for finding controllers and views is to be overridden
• The Directory structure is something like (note this is just an example):
/application
..myapp
....Catchall
Controller.php
....Error
Controller.php
....Page
Controller.php
Page.php
....Views
..config
config.xml
..layout
....common
header.inc.php
footer.inc.php
master.php
/library
..mylibrary
/web
index.php
It needs to abandon the default behaviour of looking straight under a controller directory for a controller named after what is has got from the Request object – i.e. /news/list will not map to a NewsController with a listAction method.
Likewise the view script naming conventions are not to be determined from the controller. These will be looked up from a database.
The question is how do I cleanly override this default behaviour, without putting the same code in each controller I need to create?
|