【问题标题】:Symfony 2 - htmlentities and data-prototype attributeSymfony 2 - htmlentities 和 data-prototype 属性
【发布时间】:2012-08-05 17:08:01
【问题描述】:

我正在 Symfony 2 中制作表单。在我的 buildForm 函数中,我有 prototype 选项 等于 true 来生成用于制作动态集合的 html 代码。代码如下所示:

$builder
->add('items', 'collection' ,array(
        'type' => $this->itemType,
        'allow_add' => true,
        'prototype' => true,
    )
);

在我更新供应商之前,这个数组键使 html sn-p 代码带有 htmlentities,现在代码带有“”,所以就变成了错误。

之前

data-prototype="<div><label class="   required">$$name$$</label><div...

现在

data-prototype="<div><label class=" required">$$name$$</label><div     id="apoyoCollection_items_$$name$$"><div><label...

有人知道如何解决这个问题吗?

【问题讨论】:

    标签: php symfony


    【解决方案1】:

    我已经解决了这个问题。

    有人在项目中将 config.yml 中的 Twig 配置更改为 iso8559-1,如下所示:

    twig: 
        charset: ISO-8859-15
    

    【讨论】:

      猜你喜欢
      • 2011-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-13
      • 2011-02-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多