form.php
and form.ini
. The first one is here, and I'll tell you about the second one.<?php
require_once 'Zend/Loader.php' ;
Zend_Loader :: registerAutoload ();
$view = new Zend_View ();
$view -> doctype ( Zend_View_Helper_Doctype :: XHTML1_STRICT );
$conf = new Zend_Config_Ini ( 'form.ini' );
$form = new Zend_Form ( $conf );
$form -> setView ( $view );
echo $form ;
attrs.*
.;;;;
;;;; form.ini
;;;;
action = /some/url
; post | get | put | delete
method = post
; "application/x-www-form-urlencoded" | "multipart/form-data"
enctype = "custom-enctype"
; Description
description = "form description"
; Fieldset
legend = "form legend"
; <form name="">
name = "attr name"
; int - SubForm ( )
order = 1
; true | false - -
; ini- (. decorators.*)
disableLoadDefaultDecorators = false
; true | false -
disableTranslator = false
; attribs.* - <form>
attribs.action = /yet/another/url ; action
attribs.my_pretty_cool_attr = value ; <form my_pretty_cool_attr="value"/>
; defaults.* - -.
defaults.myfield = "Default value for my field"
defaults.anotherfield = "Pretty nice value for another field""
; prefixPath -
; :
prefixPath.prefix = Zend_Form_
prefixPath.path = Zend/Form/
; Zend_Form_Decorator_MyDecorator
; Zend/Form/Decorator/MyDecorator.php
; Zend_Form_Element_MyElement Zend/Form/Element/MyElement.php
; , , :
prefixPath.zend.element.prefix = Zend_Form_Element_
prefixPath.zend.element.path = Zend/Form/Element/
prefixPath.zend.decorator.prefix = Zend_Form_Decorator_
prefixPath.zend.decorator.path = Zend/Form/Decorator/
prefixPath.custom.prefix = MyProject_Form_
prefixPath.custom.path = MyProject/Form/
; elementPrefixPath - , elements.*
; ,
; , prefixPath.*
elementPrefixPath.decorator.prefix = Zend_Form_Decorator_
elementPrefixPath.decorator.path = Zend/Form/Decorator/
elementPrefixPath.filter.prefix = Zend_Filter_
elementPrefixPath.filter.path = Zend/Filter/
elementPrefixPath.validate.prefix = Zend_Validate_
elementPrefixPath.validate.path = Zend/Validate/
; displayGroupPrefixPath - prefixPath.*
; defaultDisplayGroupClass - .
; - Zend_Form_DisplayGroup
defaultDisplayGroupClass = Zend_Form_DisplayGroup
; decorators.* - .
; -.
; : FormElements, !
; -:
decorators.elements = FormElements
decorators.tag = HtmlTag
decorators.tag.options.tag = dl
decorators.tag.options.class = zend_form
decorators.form = Form
; displayGroupDecorators.* -
;
; displayGroups.groupName.options.decorators.*
; displayGroupDecorators.*, :
displayGroupDecorators.el = FormElements
displayGroupDecorators.tg = HtmlTag
displayGroupDecorators.tg.options.tag = dl
displayGroupDecorators.fs = Fieldset
displayGroupDecorators.dt = DtDdWrapper
; elementDecorators.* -
; elements.myfield.options.decorators.*
; elementDecorators.*, :
elementDecorators.vh = ViewHelper
elementDecorators.er = Errors
elementDecorators.ht = HtmlTag
elementDecorators.ht.options.tag = dd
elementDecorators.lb = Label
elementDecorators.lb.options.tag = dt
; elementsBelongTo - -, .
; SubForm's.
; , as is (, <input name="myfield"/>)
; :
elementsBelongTo = wholeFormElements
;
; ( : <input name="wholeFormElements[myfield]"/>
; :
; elements.myfield.options.belongsTo
; elementFilters.* - -
elementFilters.flt1.filter = StringTrim
elementFilters.flt1.options.chatList = " _-"
; ,
; .filter - Zend_Filter_
; elements.* -
; elements.FIELDNAME.type - Zend_Form_Element_
; elements.FIELDNAME.type = Text - Zend_Form_Element_Text
elements.myfield.type = Button
elements.myfield.options.label = "Click me ;-)"
; elements.foobar.name = FIELDNAME - :
elements.a.name = myfield
elements.a.type = Text
elements.a.options.required = true
...
; elements.FIELDNAME.options.* - : , , , ..
; displayGroups.* - . - <fieldset/>
displayGroups.foo.name = mygroup
displayGroups.foo.options.legend = "Display Group Visible Title"
displayGroups.foo.options.order = 1
displayGroups.foo.options.description = "Cool fields" ; Description
displayGroups.foo.options.decorators.* ; displayGroupDecorators.*
displayGroups.foo.elements.a = myfield1 ; , elements.myfield1
displayGroups.foo.elements.b = myfield2 ;
Source: https://habr.com/ru/post/46111/
All Articles