Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Trouble with including ie7.css and ie6.css in page.ss

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1746 Views
  • TotalNet
    Avatar
    Community Member
    181 Posts

    Trouble with including ie7.css and ie6.css in page.ss Link to this post

    So, the theory is that with a condition in your <head> section you can import a CSS file with overrides for IE6 and IE7.

    Problem is, the CMS is generating the page with the standard <link rel="stylesheet" ... > tags after the <!-- [IF IE 7]> condition so the precedence is in the wrong order.

    Am using SS2.3.1, with <% require themedCSS(layout) %> etc. above the conditional comment in page.ss in a custom theme.

    I have tried commenting out Requirements::themedCSS("layout"); etc in page.php as well but the <link rel="stylesheet" ... > still only gets generated immediately before </head>

    Same result if I set theme to blackcandy. I have made some changes to page.php but nothing that should cause this.

    Only Solution is to remove Requirements::themedCSS("layout"); and <% require themedCSS(layout) %> from page.php and page.ss and hard-code the <link rel="stylesheet" type="text/css" href="http: ... /css/layout.css" /> etc.

    Anyone else finding this or any ideas?

    Cheers,

    Rich

    [edit]Have tested original version of page.php (as shipped with 2.3.1 stable build) with same results (after /dev/build)[/edit]

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Trouble with including ie7.css and ie6.css in page.ss Link to this post

    Yea that's an issue, I get around it by putting this in my Page.php

    public function init() {
          parent::init();

          Requirements::themedCSS("layout");
          Requirements::themedCSS("typography");
          Requirements::themedCSS("form");
          $tags = '
             <!--[if lte IE 6]>
             <link rel="stylesheet" type="text/css" href="themes/example/css/ie6.css" />
             <![endif]-->
             <!--[if IE 7]>
             <link rel="stylesheet" type="text/css" href="themes/example/css/ie7.css" />
             <![endif]-->';
          Requirements::insertHeadTags($tags);
       }

    Not ideal but it does the trick

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: Trouble with including ie7.css and ie6.css in page.ss Link to this post

    So it's not just me then, thanks.

    I can't find a bug bug raised for this, has it been discussed before? I did search the forum prior to posting but hitting the right keywords isn't guaranteed.

    Could someone testing 2.3.2rc check this out perhaps? I'm not really geared-up for beta testing right now and if it's not fixed in v2.3.2 then perhaps it should be.

    Nice solution you've posted there but for now I'll stick to hard-coding the css into the template.

    Cheers,

    Rich

    1746 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.