Zend 框架装饰器问题 [英] Zend framework decorators question

查看:35
本文介绍了Zend 框架装饰器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在输入字段前后添加一些带有文本的随机 html 内容.

I need to add some random html content with text before and after my input field.

我知道我可以使用 description 装饰器并将转义选项设置为 false - 这样我就可以简单地注入任意 html 块作为装饰器.

I know I can use description decorator and set escape option to false - this way I can simply inject arbitrary html chunk as a decorator.

但这仅占 1 个 html 块 - 在输入字段之后我需要第二个.如果我只是在输入字段之后再次输出描述装饰器 - 这将输出相同的描述 chucnk.

But this only accounts for 1 html chunk - I need a second one after input field. If I simply output description decorator again after input field - that will output the same description chucnk.

1) 有没有办法对不同的内容多次使用描述装饰器?

1) Is there a way to use description decorator multiple times with different content?

2) 在标签装饰器中 - 有没有办法使用 span 标签而不是标签标签?

2) In label decorator - is there a way to use span tag instead of label tag?

3) 我可以将随机 html 注入 HtmlTag 装饰器吗?

3) Can I inject random html into HtmlTag decorator?

谢谢!

更新:我通过创建简单的自定义装饰器解决了我的问题,该装饰器允许我在任何地方注入随机 html.仍然 - 如果有人知道快速简便的答案 - 请发帖.

update: i solved my problem by creating simple custom decorator that allows me inject random html anywhere. Still -if someone knows quick and easy answers - plz post.

推荐答案

您可以查看 AnyMarkup 装饰器:

You could check out the AnyMarkup decorator:

http://www.zfsnippets.com/snippets/view/id/62/anymarkup-decorator

这篇关于Zend 框架装饰器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆