【问题标题】:How to use symfony's use_dynamic_javascript() helper?如何使用 symfony 使用动态 javascript() 助手?
【发布时间】:2009-06-18 03:00:15
【问题描述】:

在任何地方都没有使用示例,甚至没有说明如何使用它。

【问题讨论】:

    标签: php frameworks symfony1


    【解决方案1】:

    这里是源代码,随心所欲。 (在 IMO 看来并不过分有用)。

    566 /**
    567  * Adds a dynamic javascript to the response object.
    568  *
    569  * The first argument is an internal URI.
    570  * The helper automatically adds the sf_format to the internal URI, so you don't have to.
    571  *
    572  * @see sfResponse->addJavascript()
    573  */
    574 function use_dynamic_javascript($js, $position = '', $options = array())
    575 {
    576   $options['raw_name'] = true;
    577 
    578   return use_javascript(_dynamic_path($js, 'js'), $position, $options);
    579 }
    

    【讨论】:

    • 谢谢伊恩!我只是好奇它是否足以显着帮助构建动态 JavaScript。
    【解决方案2】:

    我知道这个问题已经过时了,但我认为我们中的许多人仍然存在这个问题:)

    在把我的头撞到墙上几个小时之后,我想和你分享一些信息:P

    如何在 symfony here 中使用 use_dynamic_javascript() 助手。

    【讨论】:

      【解决方案3】:

      显然,这个助手添加了非静态(由你生成)JS 来响应。第一个参数是一个 url,就好像它被传递了url_for()

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-11-01
        • 2016-10-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-12-09
        相关资源
        最近更新 更多