I have to translate this code:
<!--[if IE 7]> <link rel="stylesheet" type="text/css" href="css/ie7-style.css" /> <![endif]-->
for CakePHP. At the moment I'm using $this->Html->css('fileName') in the view file and in the default.ctp I do echo $this->fetch('css');
But what do to when i must to use a conditional css expression like above?
Thanks
If you want conditionals set inside a view file (as in not in a layout), you can do:
// in your view file
$this->Html->css('file', null, array('block' => 'ie_conditional_css'));
// in layout
<?php if ($ieConditionalCss = $this->fetch('ie_conditional_css')): ?
<!--[if lt IE 8]><?php echo $ieConditionalCss ; ?><![endif]-->
<?php endif; ?>
You just put the comments around your PHP, like this:
<!--[if lt IE 8]><?php echo $html->css('filename') ?><![endif]-->
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With