开发者

Base path for Zend ViewScript decorator

开发者 https://www.devze.com 2023-02-28 06:40 出处:网络
I need to change the rendering of an element in my Zend_Form. I like the idea of the Zend_Form_Decorator_ViewScript but I\'m not using Zend\'s MVC and can not (after three hours of searching) find how

I need to change the rendering of an element in my Zend_Form. I like the idea of the Zend_Form_Decorator_ViewScript but I'm not using Zend's MVC and can not (after three hours of searching) find how to set the path to the base directory of the viewScript. I have tried every option I could find but nothing works. I get this message:

'no view script directory set; unable to determine location for view script'

If anyone can point me in the right direction or fill in the blanks for this piece of code you would make my day!

  $this->addElement(
     "text",
     "customer_name",
     array(
        "label"=&开发者_StackOverflowgt;"Your name",
        "required"=>false,
        "decorators"=>array(
           "PrepareElements",
           array(
              "ViewScript",
              array(
                 "viewScript"=>"customer_name.html"
              )
           )
        )
     )
  );

Please again note that I am not using Zend's MVC so I need to set the path explicitly.


Iam note sure, it is along time ago since i have used Zend Framework without MVC Structure, but this should work (based on the Example link in the comments)

$view = new Zend_View();
$view->doctype('XHTML1_TRANSITIONAL');
$view->setBasePath('/path/to/your/view');

$form = new Zend_Form();
$form->setView($view);
0

精彩评论

暂无评论...
验证码 换一张
取 消