2010年10月28日星期四

Re: [fw-mvc] Forms and HTML

I absolutely agree with David here. Decorators are technically well
designed and fine... but they are sometimes just a way too heavy
weapon for a small view level bells and whistles. At least for my
taste.

m.

On Tue, Oct 26, 2010 at 3:45 PM, David Mintz <david@davidmintz.org> wrote:
> It may be sacriligious to those who really love to do everything
> programmatically, but I think there is a lot to be said for going a sort of
> Middle Way and writing view scripts that render Zend_Form elements
> semi-manually, as it were. I sometimes do things like the following. It
> might be ugly, but it saves me from the torture of mastering all the nuances
> of decorators etc and gets the job done:
>
> <dl>
> <?= $I->mobile?>
> <?= $I->home ?>
> <?= $I->fax?>
> <?= $P->office_phone->renderLabel()?>
> <dd><?= $P->office_phone->renderViewHelper()?><?php if
> ($P->office_phone_ext) : ?>
> <?=$this->formLabel('person_office_phone_ext','Ext')?> <?=
> $P->office_phone_ext->renderViewHelper()?><?php endif; ?></dd>
> <?= $I->address1?>
> <?= $I->address2?>
> <dt>City</dt>
> <dd><?= $I->city->renderViewHelper()?> State <?=
> $I->state->renderViewHelper()?></dd>
> <?= $I->zip?>
> </dl>
>
> On Friday 22 Oct 2010 21:53:59 Thomas List wrote:
>> I've been trying without any luck to add HTML to a Zend_Form.  I started
>> out with just trying to add a font to a label for one of the fields in my
>> form:
>>
>>  $this->addElement('select','types', array(
>>             'label'      => 'What type of home do you live in:',
>>             'required'   => true,
>>             'multiOptions' => array( 'Existing Home' => 'Existing Home',
>> 'New Construction' => 'New Construction', 'Condominium' => 'Condominium',
>> 'Apartment' => 'Apartment',),));
>>
>>
>> but when I add the html, Zend just renders it as text.  I've read
> something
>> about adding an esacape=>false to $decorators element or something, but I
>> really am not sure how to do so.  I would really appreciate some guidance
>> on this, as I can't seem to find a straightforward example.
>>
>> Thanks,
>> Thomas List
>
>
> --
> David Mintz
> http://davidmintz.org/
> It ain't over:
> http://www.healthcare-now.org/
>

没有评论: