English 中文(简体)
如何在泽德框架中形成风格?
原标题:How to style forms in the Zend framework?

我真像把表格归入管理验证等的恰当类别的想法,但我不喜欢以数字表示最后的一切,也未能在<代码><、投入类型=核对箱名称=数据[]和“

是否有另一种产生形式的方式——如观点一样,我可以把形式描述为我所希望的方式,但也保持验证方面? 我还将如何把这一看法纳入我目前的看法(利用部分观点?)

最佳回答

我建议采用全方位的《观点》,以管理如何展示你的形式要素。

例如,如果你希望把他们作为清单展示,你会采取类似形式。

<?php
class Default_Form_Myform extends Zend_Form
{
    public function  __construct($options = null) {
        parent::__construct($options);
    }
    public function  init() {
        parent::init();
        $this->setName( myform );
        $name = new Zend_Form_Element_Text( name );
        $name->setLabel( Name )
                    ->setDescription( Give your name... );
        $this->addElement($name);            
        $submit = new Zend_Form_Element_Submit( submit );
        $this->addElement($submit);        
        $this->clearDecorators();
        $this->setElementDecorators(
                array(
                     viewHelper ,
                     Errors ,
                    array( Label , array( class  =>  delabel )),
                     Description ,
                    array( HtmlTag , array( tag  =>  li )),        
                )
        );           
        // The template is at application/modules/default/views/myForm.phtml
        $this->setDecorators(array(
        array( ViewScript , array( viewScript  =>  myForm.phtml ))
        ));  
    }
}

Then you would have a template at application/modules/default/views/myForm.phtml

所有内容均按其申报名称($this->element-> 姓名:

<form action="<?= $this->element->getAction(); ?>"
      method="<?= $this->element->getMethod(); ?>"
      enctype="<?= $this->element->getEnctype(); ?>"
      name="<?= $this->element->getName(); ?>">
    <ul>
    <?= $this->element->name; ?>
    <?= $this->element->submit ?>
    </ul>
</form>

Now in your view script you just need to echo the form like you normally would <?= $this->form; ?>

www.un.org/Depts/DGACM/index_spanish.htm 注一米,使用模块,您可能或不可能在目录和类别名称中注明。

Please consider accepting answers to your questions...

对于那些作出答复的人来说,这样做是值得的。

问题回答

你正在寻找一种形式“dec子”。 http://devzone.zend.com/article/3450"rel=“nofollow”

EDIT:链接截至2015年6月已死亡。 参看link 转载于

http://framework.zend.com/manual/en/zend.form.advanced.html”rel=“nofollow”http://framework.zend.com/manual/en/zend.form.advanced.html

你们可以通过设立自己的矫正机构来消除诽谤。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签