-- fozzyuw <[EMAIL PROTECTED]> wrote (on Tuesday, 30 September 2008, 01:14 PM -0700): > I've got an INI file for configuring a series of Zend SubForms and I'm > trying to see if there's a way I can condense the following code... > --------- > $config = new Zend_Config_Ini('projectForms.ini', 'project form'); > > $subforms = array(); > > $subforms['title'] = new Zend_Form_SubForm($config->project->form->title); > $subforms['dates'] = new Zend_Form_SubForm($config->project->form->dates); > $subforms['resources'] = new > Zend_Form_SubForm($config->project->form->resources); > [...] > > // Attach sub-forms to main form > $this->addSubForms($subforms); > --------- > > I have 11 subForms right now. I'm wondering if there's a way I can just > feed the entire subForm INI object to the Form constructor and it'll create > all the subforms automatically.
Not currently, though it's something I'd like to change in an upcoming version. If you want to see it sooner, extend Zend_Form and create a new method for adding sub forms that does not require a Zend_Form object. > I can't seem to find any details on this > and it seems "addSubForms()" only takes Form objects (or an array of Form > objects). > > I'd like to see if something like this is possible... > > ---------- > $config = new Zend_Config_Ini('projectForms.ini', 'project form'); > $this->addSubForms($config->project->form); > ---------- -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/