Symfony 自动生成的后端应用程序未加载任何样式表

发布于 2024-11-18 16:06:01 字数 2368 浏览 4 评论 0原文

我正在开发一个 symfony 项目,但现在我是一个网络开发新手,我正在做著名的 jobeet 教程。

我的问题是:

当我自动生成后端应用程序时,我看到 /apps/backend/templates/layout.php 文件中定义的普通布局。我在生成其他东西时也发生过这种情况,但这次我没有文件可以触摸并手动添加样式表。所以

我的问题是:

我必须修改的文件在哪里才能应用 *.css 文件? (如果有)

线索:我在服务器的 Web 根文件夹 (/var/www/) 上没有 jobeet 项目,我将它放在该目录 (/var/ www/文件夹/jobeet/)。这可能是问题的原因吗? (也许某些自动生成的配置文件具有绝对路径)

clue_2:查看 html 代码,我可以看到对样式表文件的引用:

<link rel="stylesheet" type="text/css" media="screen"    href="/folder/jobeet/web/sfPropelPlugin/css/global.css" /> 
<link rel="stylesheet" type="text/css" media="screen"     href="/folder/jobeet/web/sfPropelPlugin/css/default.css" /> 
<link rel="stylesheet" type="text/css" media="screen" href="/folder/jobeet/web/css/main.css" /> 
<link rel="stylesheet" type="text/css" href="/folder/jobeet/web/css/admin.css" /> 

编辑:

在后端的作业和类别模块中,唯一的文件是生成器。 yml。例如,在作业文件中,我可以找到以下内容:

generator:
  class: sfPropelGenerator
  param:
  model_class:           JobeetJob
  theme:                 admin
  non_verbose_templates: true
  with_show:             false
  singular:              JobeetJob
  plural:                JobeetJobs
  route_prefix:          jobeet_job
  with_propel_route:     1
  actions_base_class:    sfActions

config:
  actions: ~
  fields:
    is_activated: { label: Activated?, help: Whether the user has activated the job, or not }
    is_public:    { label: Public?, help: Whether the job can also be published on affiliate websites, or not }
  list:
    title:  Job Management
    layout:  stacked
    display: [company, position, location, url, is_activated, email]
    #params:  |
    #  %%is_activated%% <small>%%category_id%%</small> - %%company%%
    # (<em>%%email%%</em>) is looking for a %%=position%% (%%location%%)
  filter:  ~
  form:    ~
  edit:
    title:  Editing job "%%company%%" is looking for a "%%position%%"
  new:
    title:  Job Creation

当我取消注释参数行时,我收到 500 服务器内部错误消息。当它是从教程网络复制+粘贴时,真的很令人沮丧。

已解决:

出于某种奇怪的原因,删除了 params: 定义(在生成器.yml 中)的多行模式,样式表加载正确。我不知道为什么会这样:S

`params:  %%is_activated%% <small>%%category_id%%</small> - %%company%% (<em>%%email%%</em>) is looking for a %%=position%% (%%location%%)`

i'm working on a symfony project, but by now that i'm a noob in web developement i'm doing the famous jobeet tutorial.

My problem is:

When i autogenerate the backend app, i see the plain layout defined in the /apps/backend/templates/layout.php file. This have happened to me generating other things but this time i have no files to touch and manualy add the style sheets. So

my question is:

Where are the files i have to modify to apply a *.css file? (if any)

clue: i don't have the jobeet project on the web root folder in the server (/var/www/), i have it in a subdirectory in that directory (/var/www/folder/jobeet/). Can this thing be the cause of the problem? (maybe some autogenerated configuration files have absolute routes)

clue_2: looking at the html code i can see the references to the stylesheet files:

<link rel="stylesheet" type="text/css" media="screen"    href="/folder/jobeet/web/sfPropelPlugin/css/global.css" /> 
<link rel="stylesheet" type="text/css" media="screen"     href="/folder/jobeet/web/sfPropelPlugin/css/default.css" /> 
<link rel="stylesheet" type="text/css" media="screen" href="/folder/jobeet/web/css/main.css" /> 
<link rel="stylesheet" type="text/css" href="/folder/jobeet/web/css/admin.css" /> 

Edit:

in the backend's job and category modules, the only files are generator.yml. In the job file, for example, i can find this:

generator:
  class: sfPropelGenerator
  param:
  model_class:           JobeetJob
  theme:                 admin
  non_verbose_templates: true
  with_show:             false
  singular:              JobeetJob
  plural:                JobeetJobs
  route_prefix:          jobeet_job
  with_propel_route:     1
  actions_base_class:    sfActions

config:
  actions: ~
  fields:
    is_activated: { label: Activated?, help: Whether the user has activated the job, or not }
    is_public:    { label: Public?, help: Whether the job can also be published on affiliate websites, or not }
  list:
    title:  Job Management
    layout:  stacked
    display: [company, position, location, url, is_activated, email]
    #params:  |
    #  %%is_activated%% <small>%%category_id%%</small> - %%company%%
    # (<em>%%email%%</em>) is looking for a %%=position%% (%%location%%)
  filter:  ~
  form:    ~
  edit:
    title:  Editing job "%%company%%" is looking for a "%%position%%"
  new:
    title:  Job Creation

When i uncomment the param lines i have a 500 server internal error message. Is really frustrating when its a copy+paste from the tutorial web.

Solved:

For some strange reason, removing the multiline mode fo the params: definition (in generator.yml) the stylesheet loads correctly. I dont have idea why is that :S

`params:  %%is_activated%% <small>%%category_id%%</small> - %%company%% (<em>%%email%%</em>) is looking for a %%=position%% (%%location%%)`

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

安穩 2024-11-25 16:06:01

你有使用这个命令吗?

symfony plugin:publish-assets

这必须在您的 Web 目录中“创建”sfPropelPlugin 目录...

Do you have use this command ?

symfony plugin:publish-assets

This must "create" sfPropelPlugin directory in your web directory...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文