Symfony4,原始 HTML 和 CSS 使用 TWIG
Symfony4 , Raw HTML and CSS using TWIG
我正在尝试 运行 我的 Symfony4 项目中的免费前端模板,我将 index.html(模板的)更改为 index.html。php所以它可以被 Symfony 的 PHP 引擎支持。但它仍然显示没有任何样式或 img 的普通文本。我不确定这是路径问题还是渲染问题。
在我的 index.html.php 中,我想引用我的资产目录(其中包含 img、css、...等),它与我的 index.html.php,这里是主题文件和目录的完整路径:
myproject/src/Resources/views/test/freeTemplateName/template/index.html.php
myproject/src/Resources/views/test/freeTemplateName/template/assets/.......
我认为您的资产不应该放在 src
文件夹中,而应该放在 public
文件夹中。例如,您可以将 css 放在 public/css/myfile.css
中。然后像通常在 <head>
标签中那样在 index.html.php 中引用该文件。
我正在尝试 运行 我的 Symfony4 项目中的免费前端模板,我将 index.html(模板的)更改为 index.html。php所以它可以被 Symfony 的 PHP 引擎支持。但它仍然显示没有任何样式或 img 的普通文本。我不确定这是路径问题还是渲染问题。 在我的 index.html.php 中,我想引用我的资产目录(其中包含 img、css、...等),它与我的 index.html.php,这里是主题文件和目录的完整路径:
myproject/src/Resources/views/test/freeTemplateName/template/index.html.php
myproject/src/Resources/views/test/freeTemplateName/template/assets/.......
我认为您的资产不应该放在 src
文件夹中,而应该放在 public
文件夹中。例如,您可以将 css 放在 public/css/myfile.css
中。然后像通常在 <head>
标签中那样在 index.html.php 中引用该文件。