开发者

Base path for Zend ViewScript decorator

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜