Yii Framework Forum: Additional parameter for "registerCssFile" - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Additional parameter for "registerCssFile" What about adding a condition parameter Rate Topic: -----

#1 User is offline   mintao 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 02-December 09
  • Location:Munich, Germany

Posted 05 February 2010 - 06:37 PM

Ofter you need to add a browser specific css - e.g. for our friend, the IE6. So I was looking for a "conditional" parameter.

instead of:
`public void registerCssFile(string $url, string $media='')`

I'd request a third parameter:
`public void registerCssFile(string $url, string $media='', string $condition='')`

so this:
Yii::app()->clientScript->registerCssFile('/css/ie.css', 'screen, projection', 'lt IE 8');



would produce this:

<!--[if lt IE 8]>
    <link rel="stylesheet" type="text/css" href="/css/ie.css" media="screen, projection" />
<![endif]-->

3

#2 User is offline   heyhoo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 25-January 10

Posted 22 February 2010 - 03:04 PM

Good idea! I was searching for this option as well. At this moment it seems not possible to use registerCssFile for a browser specific css and sometimes you just need that. May I suggest to add this third parameter to the registerScriptFile function as well.
1

#3 User is offline   choiceerp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 10
  • Location:EUROPA - France - Paris

Posted 16 May 2010 - 05:22 PM

Very good, I need it
I'm very impatient that future will be integrated in the yii distrib
knowledge is valid only if it is shared ;-)
0

#4 User is offline   Eric Lund 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 29-November 10

Posted 14 January 2011 - 05:10 PM

This is just what I was looking for. I'd love to see this in Yii.
0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,545
  • Joined: 17-January 09
  • Location:Russia

Posted 15 January 2011 - 06:17 PM

http://code.google.c.../detail?id=1240
0

#6 User is offline   nothing 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-October 13

Posted 08 January 2014 - 05:38 AM

Hi samdark,

how to use conditional classes in <html> tag in case we use a third party library?
ex:
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.css">
<!--[if IE 7]>
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome-ie7.css">
<![endif]-->

We shouldn't merge font-awesome-ie7.css to font-awesome.css because it hard to migrate to new version
0

#7 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,545
  • Joined: 17-January 09
  • Location:Russia

Posted 08 January 2014 - 07:18 AM

If the library is used sitewide as font awesome, you can paste it as HTML in layout file.
0

#8 User is offline   nothing 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 28-October 13

Posted 10 January 2014 - 02:01 AM

View Postsamdark, on 08 January 2014 - 07:18 AM, said:

If the library is used sitewide as font awesome, you can paste it as HTML in layout file.

Thank for your feedback but i think it will more flexible if we have an option to allow insert prefix and suffix for each Css/Javascript file (IE condition or comment for example)
0

#9 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,545
  • Joined: 17-January 09
  • Location:Russia

Posted 13 January 2014 - 09:11 AM

Probably. Please create an issue at github and we'll look into it. Can't promise that it will be solved and solved fast though. Thanks.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users