-- Greg Donald <
gdonald@...> wrote
(on Thursday, 29 May 2008, 12:56 PM -0500):
> On 5/29/08, Matthew Weier O'Phinney <
matthew@...> wrote:
> > The helpers that are doctype aware are only considering whether or not
> > they are HTML or XHTML -- strictness is not considered.
> >
> > Additionally, you can always switch doctype temporarily within your
> > application view scripts if they need to emit differently than the rest
> > of the application
>
> Is there a way to do it in the bootstrap?
>
> Something like this pseudo code?
>
> if controller name == 'admin' && action name == 'index'
> // set frameset doctype
> else
> // set regular doctype
I'd do this in a preDispatch() plugin:
class My_Plugin_Doctype extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->initView();
$view = $viewRenderer->view;
if (('admin' == $request->getControllerName())
&& ('index' == $request->getActionName()))
{
// set frameset doctype
$view->doctype('XHTML1_FRAMESET');
} else {
// set regular doctype
$view->doctype('XHTML1_STRICT');
}
}
}
Then, register this in your bootstrap:
$front->registerPlugin(new My_Plugin_Doctype);
--
Matthew Weier O'Phinney
Software Architect |
matthew@...
Zend - The PHP Company |
http://www.zend.com/