变量“asset_url”不存在

时间:2016-01-12 12:30:44

标签: symfony twig theming

不确定有什么问题,但我不能包含javascript和/或样式表文件。使用Symfony3

   from   #Head         hw
      join   Employee           et
        on   hw.EmployeeCode    = et.EmployeeCode
       and   et.BonusFlag       = 1
      join   Bonus           cb
        on   hw.BonusId             = cb.BonusId 
        and  cb.CompanyId           = @CompanyId
      join   bonus b
        on   hw.BonusId             = b.BonusId 
      join   Expense     pr
        on   pr.CompanyId           = @CompanyId
       and   pr.ModuleId         = b.ModuleId   
     Where   hw.BucketId        =  @BucketId
       and   upper (et.EmployeeCode)     <> 'H'
       and   hw.bucketcode not in (Select centercode from NExclusion)

收到此错误: 第32行的security / login.html.twig中不存在变量“asset_url”

1 个答案:

答案 0 :(得分:0)

总的来说,代码可能看起来像这样:

{% block javascripts %}
    {% javascripts
        '@AppBundle/assets/js/jquery.js'
        '@AppBundle/assets/bootstrap/js/bootstrap.min.js'
        output='js/compiled/app.js' %}
        <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}
{% endblock %}

如果它不起作用,请确保这些文件的路径正确。