相关疑难解决方法(0)

覆盖捆绑中的图像

我有这个:

ShopBundle
  Controller
  Resources
    public
      images
        marker.png
    views
      Default
        index.html.twig
Run Code Online (Sandbox Code Playgroud)

在我的index.html.twig中,我想要这个

<img src="{{ asset("images/marker.png") }}"/>
Run Code Online (Sandbox Code Playgroud)

我喜欢使用我的捆绑包的人,他们只想使用他们自己的marker.png来构建一个继承我的捆绑包,并通过以下文件结构放置他们的图像:

MyShopBundle
  Resources
    public
      images
        marker.png
Run Code Online (Sandbox Code Playgroud)

在Symfony2中有没有简单的方法呢?需要似乎很简单,我无法相信我没有找到答案.

所以,

  • 如何在捆绑资源目录中的捆绑模板中包含图像资源?我已经做了./apps/hfr/console assets:install web但是我的模板没有打印出正确的网址(/ images/marker.png而不是/ bundles/ShopBundle/Resources/public/images/png)

  • 是否有可能覆盖我想要的方式或者我迷失了方向?

symfony

5
推荐指数
1
解决办法
2462
查看次数

标签 统计

symfony ×1