2013-01-20 74 views
1

我試圖改變CSS鏈接的href屬性。問題在於它沒有顯示引用問題的變異{{app.user.tema}}symfony2小枝變量

{% 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 %} 

我得到的錯誤是:

參數必須用逗號分隔。意外的標記的值「標點符號」,「{」在appappBundle(「標點符號」預期與值","):默認:index.html.twig在管線9

回答

2

加入的變量並使用〜字符串可能工作:

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

非常感謝工作! – faisbu