Symfony 1.2中的条件ie css包含

Symfony 1.2中的条件ie css包含,css,symfony1,Css,Symfony1,我想为IE加载另一个css。我正在使用Symfony 1.2。最快的方法是什么?我不想使用“view.yml”技术。我想在我的大脑里有这样的东西: <link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" /> <!--[if lte IE 7]> <link rel="stylesheet" href="css/ie6.css" type="t

我想为IE加载另一个css。我正在使用Symfony 1.2。最快的方法是什么?我不想使用“view.yml”技术。我想在我的大脑里有这样的东西:

<link rel="stylesheet" href="css/screen.css" type="text/css" media="screen" />
      <!--[if lte IE 7]>
        <link rel="stylesheet" href="css/ie6.css" type="text/css" media="screen" /> 
<![endif]--> 

我目前在layout.php文件中有这段代码,用于包含样式表

<?php include_http_metas() ?>
<?php include_metas() ?>
<?php use_stylesheet('style.css') ?>



你们知道什么快速解决方案吗?

Symfony不支持有条件的评论


最简单的方法是将其准确地放入布局文件中,但不要硬编码href属性,而是使用
public\u路径
helper。

我看不出有什么问题。只需将此代码放入layout.php

<?php include_http_metas() ?>
<?php include_metas() ?>
<?php use_stylesheet('style.css') ?>
<!--[if lte IE 7]>
  <?php echo stylesheet_tag('ie6'); ?>
<![endif]-->

将ie6.css放入样式表目录


这种方法更简单,因为您不必硬编码css目录的路径。

Symfony支持有条件的css和JS,我看不出不使用view.yml的原因-在view.yml中编写就足够了(例如apps/frontend/config/view.yml)

CSS:

JS:


另一种选择是在操作中使用该方法。 例如:


? 对不起,你能举个例子吗?@Jojje你得到的另一个答案和我的意思差不多。
stylesheets:
 - ie6.css: { condition: IE 6 }
javascripts:
 - myiescript.js: { condition: IE 6 }
$response->addStylesheet('ie8.css', '', array('condition' => 'IE 8'));