Reputation: 4602
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
Upvotes: 3
Views: 2380
Reputation: 6767
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; ?>
Upvotes: 3
Reputation: 25455
You just put the comments around your PHP, like this:
<!--[if lt IE 8]><?php echo $html->css('filename') ?><![endif]-->
Upvotes: 3