FlashMessanger 中的局部视图脚本 [英] Partial View Script in FlashMessanger

查看:53
本文介绍了FlashMessanger 中的局部视图脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将局部视图脚本解析为快闪消息?

Is there a way to parse a partial view script as a flash message?

我正在使用一些带有 html 代码块的大型 Flash 消息,但读取或格式化这些消息的能力真的很糟糕.

Iam using some big flash messages with html code blocks in it and the ability to read or format those messages is really bad.

推荐答案

有多种方法可以解决您所讨论的问题,cptnk 为您提供了一种方法.然而,视图文件中的这么多代码通常不是您想要的.幸运的是,ZF2 也提供了一种通过配置来配置相同内容的方法:

There's several ways to address the issue you're talking about and cptnk offered you one. However so much code within View-Files isn't often something you want. Luckily ZF2 offers a way to configure the same thing via configuration, too:

'view_helper_config' => array(
    'flashmessenger' => array(
        'message_open_format'      => '<ul><li>',
        'message_separator_string' => '</li><li>',
        'message_close_string'     => '</li></ul>'
    )
)

这一切都在 官方我很久以前的文档,包括一个 Twitter Bootstrap 3 FlashMessenger 布局示例.您可能想亲自检查一下.

This has all been covered within the official documentation by me quite a time ago including an example of a Twitter Bootstrap 3 FlashMessenger layout. You may want to check this out for yourself.

并直接回答您最初的问题:不,不可能有一个专门的视图文件供 flashMessenger 插件使用.您必须为此编写自己的 flashMessenger 实现.

And to give you a straight out answer to your initial question: no it's not possible to have a dedicated view-file to be used by the flashMessenger plugin. You'd have to write your own flashMessenger implementation for this.

这篇关于FlashMessanger 中的局部视图脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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