问题
I have a simple Template (layout.php) and I use Propel as ORM.
When i include sylesheets (into of layout.php) with the function: include_stylesheets()
I became 2 css:
/sfPropelORMPlugin/css/global.css
/sfPropelORMPlugin/css/default.css
why?
when I look into my view.yml actually I just have this:
default:
http_metas:
content-type: text/html
stylesheets:
has_layout: true
layout: layout
I configure no stylesheets but I see Propel css in my Head Tag!
my generator.yml :
generator:
class: sfPropelGenerator
param:
##CONFIG##
config:
actions: ~
fields: ~
list: ~
filter: ~
form: ~
edit: ~
new: ~
Is this a bug? or just a misconfiguration?
回答1:
This mainly because there are automatically loaded when you use a the admin template (see this file):
<?php if (isset($this->params['css']) && ($this->params['css'] !== false)): ?>
[?php use_stylesheet('<?php echo $this->params['css'] ?>', 'first') ?]
<?php elseif(!isset($this->params['css'])): ?>
[?php use_stylesheet('<?php echo sfConfig::get('sf_admin_module_web_dir').'/css/global.css' ?>', 'first') ?]
[?php use_stylesheet('<?php echo sfConfig::get('sf_admin_module_web_dir').'/css/default.css' ?>', 'first') ?]
<?php endif; ?>
This means you can define your own css in the generator.yml
(and it won't load the default ones), like :
generator:
class: sfPropelGenerator
param:
css: /css/my_css.css
Or removed them:
generator:
class: sfPropelGenerator
param:
css: false
edit:
And finally you can remove them from the view.yml
:
default:
http_metas:
content-type: text/html
stylesheets:
- -/sfPropelORMPlugin/css/global.css
- -/sfPropelORMPlugin/css/default.css
has_layout: true
layout: layout
来源:https://stackoverflow.com/questions/11115222/how-do-i-include-stylesheets-with-symfony-properly