Twig 模板资源解析
我的子树枝模板在正确解析其资产时遇到问题。
我的资产位于 web/bundles/mlbp/images|js|css
在我的所有其他模板继承的父树枝模板中,我有类似的内容:
{% block javascripts %}
<script src="{{ asset('bundles/mlbp/js/jQuery.js') }}" type="text/javascript"></script>
{% endblock %}
查看源代码时,它会正确解析为 /bundles/mlbp/js/jQuery.js
但在我的一个子模板中,我正在做这样的事情:
{% block javascripts %}
{{parent()}}
<script src="{{ asset('bundles/mlbp/js/tableSortInit.js') }}" type="text/javascript"></script>
{% endblock %}
由于某种原因,这会解析为不存在的 /js/tableSortInit.js 。我不明白为什么它适用于其中一个而不适用于另一个,所以任何帮助将不胜感激
I'm having problems with my child twig templates properly resolving their assets.
My assets lie in web/bundles/mlbp/images|js|css
In my parent twig template that all my other templates inherit from I have something like:
{% block javascripts %}
<script src="{{ asset('bundles/mlbp/js/jQuery.js') }}" type="text/javascript"></script>
{% endblock %}
When looking at source this resolves properly to /bundles/mlbp/js/jQuery.js
But in one of my child templates I'm doing something like this:
{% block javascripts %}
{{parent()}}
<script src="{{ asset('bundles/mlbp/js/tableSortInit.js') }}" type="text/javascript"></script>
{% endblock %}
This for some reason resolves to /js/tableSortInit.js which does not exist. I don't see why it would work in one but not the other so any help will be very appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该尝试检查与该模板相关的任何其他模板,它可能来自那些模板,特别是如果您在模板渲染等方面做了很多工作。
You should try checking any other templates that relate to that one, it may be coming from those especially if you do a lot of in template rendering etc.