1

cssのリンクのhref属性を変更しようとしています。問題は、引用符の問題を変数に表示しないこと{{app.user.tema}}です。

{% block tema%}
   {% if app.user.tema %}
     <link id = "hojaestilo" rel = "stylesheet" type = "text / css" href = "{{asset ('bundles / appapp / css / themes / {{app.user.tema}} / jquery-wijmo.css')}} "media =" screen ">
    {% endif %}
{% endblock %}

私が得るエラーは次のとおりです。

引数はコンマで区切る必要があります。","9行目のappappBundle:Default:index.html.twigの値「{」(「句読点」はvalueで予期される)の予期しないトークン「句読点」

4

1 に答える 1

2

変数と文字列を〜で結合すると機能する場合があります。

 <link id = "hojaestilo" rel = "stylesheet" type = "text/css" href = "{{asset ('bundles/appapp/css/themes/' ~ app.user.tema ~ '/jquery-wijmo.css')}}" media ="screen">
于 2013-01-20T12:06:36.683 に答える