开发者

Zend_Form: Add Link before submit-element

I want to have the link inside the DIV instead before. I want to have it look like:

<div class="clear">
  <a href="somelink">A link</a>
  <input type="submit" name="submit" id="submit" value="submit" />
</div>

But at the moment it looks like that:

<a href="somelink">A link</a>
<div class="clear">
  <input type="submit" name="submit" id="submit" value="submit" />
</div>

PHP:

$submit = new Zend_Form_Element_Submit('submit');
$submit->setL开发者_Go百科abel('submit')
       ->setDisableLoadDefaultDecorators(true)
       ->setDecorators(array(
           'ViewHelper',
           array('HtmlTag', array('tag' => 'div', 'class' => 'clear')),
           array('Description', array('escape' => false, 'tag' => false, 'placement' => 'prepend'))
       ))
       ->setDescription('<a href="somelink">A link</a>');


The best way is write your own, custom decorator. AnyMarkup decorator may be helpful.

You may be interested in this article about decorators. There is also nice Matthew's screencast about decorators on Zend Framework page.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜