You could set the suffix of choice in Bootstrap like this:
Zend_Controller_Action_HelperBroker::getStaticHelper("viewRenderer")
->setView($view)
->setViewSuffix('phaml');
--
Andreas Baumgart
http://polycast.de
On 29.01.2010, at 04:44, Konr Ness wrote:
> Andrew,
>
> http://phaml.sourceforge.net/
>
> In my cursory research, this page seems to detail a way to integrate phaml with Zend Framework. The section "hlzendex2:A Better Solution, Use AA_View_pHAML Class" is what you're looking for.
>
> Essentially, you want to replace Zend_View with AA_View_pHAML although I would recommend against initializing the phaml view in your controller, and instead put it in your Bootstrap so it's reusable everywhere.
>
> For instance:
>
> <?php
>
> class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
> {
>
> /**
> * Initialize the view resource
> *
> * @return Bear_View
> */
> protected function _initView()
> {
> $view = new AA_View_pHAML();
>
> Zend_Controller_Action_HelperBroker::getStaticHelper("viewRenderer")
> ->setView($view);
> return $view;
> }
>
> }
>
> Then the view should be accessible from the controller just like a normal view:
> $this->view->myParam = $myParam;
>
> I'm not sure how the rendering of the view would work since the default suffix will still be expected to be .phtml.
>
> You might still have to do this to render the view:
> $this->getFrontController()->setParam('noViewRenderer', true);
> $this->view->setScriptPath('D:/wamp/asf/hlzendex2/views/scripts/index');
>
> echo $this->view->render('index.hml');
>
> I'm not sure if the setScriptPath is necessary.
>
> Anyone else?
>
> Konr
>
> p.s. Why would you want to use phaml when straight PHP is faster and easier?
>
>
> On Thu, Jan 28, 2010 at 4:52 PM, Andrew Pace <andrewppace@gmail.com> wrote:
>
> Hello all,
>
> I am fairly new to zend framework and still trying to get the hang of
> it. I am curious if any of you are using phaml in your apps.
>
> I am hoping to use phaml in all my views for the entire app. So I want
> to configure it once in the bootstrap class and be able to create views
> like, "index.hml". In controllers, I would like to still assign
> variables like, "$this->view->variable = $variable". Any good examples
> to get me going. I followed the examples on
> http://phaml.sourceforge.net/ , but these still required configuration
> in the controller or view. I am hoping to do it just once in the
> bootstrap class and be done with it.
>
> Thanks,
>
> Andrew
>
>
> --
> View this message in context: http://n4.nabble.com/phaml-tp1401336p1401336.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
没有评论:
发表评论