Development

#3237 (Can't use multiple media for css stylesheets)

You must first sign up to be able to contribute.

Ticket #3237 (closed defect: worksforme)

Opened 1 year ago

Last modified 5 months ago

Can't use multiple media for css stylesheets

Reported by: Roberto.Carvajal Assigned to: fabien
Priority: minor Milestone:
Component: view Version: 1.2.4
Keywords: Cc:
Qualification: Unreviewed

Description

Sometimes we need to add multiple media definitions for stylesheets use as this example:

<link rel="stylesheet" type="text/css" media="screen, projector" href="/css/mystyle.css" />

Currently there is no way to do this via view.yml at the stylesheets definition:

If I try this way:

stylesheets: [ mystyle: { media: screen, projector } ]

Results in this:

Fatal error: Unsupported operand types in /usr/local/symfony-1.0.12/lib/util/Spyc.class.php on line 667

If I try this other way:

stylesheets: [ mystyle: { media: "screen, projector" } ]

Results in this:

<link rel="stylesheet" type="text/css" media="YAMLString" href="/css/mystyle.css" />

Change History

03/29/08 21:07:59 changed by gilles.doge

Works if you don't put a space after the comma:

  
  stylesheets: [mystyle: { media: screen,projector }]

Output:

<link rel="stylesheet" type="text/css" media="print,projector" href="/css/mystyle.css" />

But well...

03/29/08 21:38:58 changed by Roberto.Carvajal

Thank you, this wasn't documented anywhere or at least I couldn't find this anywhere.

05/05/08 16:54:44 changed by Stephen.Ostrow

  • status changed from new to closed.
  • resolution set to worksforme.

02/18/09 00:10:57 changed by laurentb

  • status changed from closed to reopened.
  • version changed from 1.0.12 to 1.2.4.
  • resolution deleted.

Doesn't work with 1.2. Outputs

<link rel="stylesheet" type="text/css" media="screen" href="/css/style: { media: handheld.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/screen }.css" />
<link rel="stylesheet" type="text/css" media="screen" href="/css/layout.css" />

for

  stylesheets:    [style: { media: handheld,screen }, layout: { media: screen }]

02/18/09 03:08:34 changed by Stephen.Ostrow

  • status changed from reopened to closed.
  • resolution set to worksforme.

I personally use the expanded hash notation, but this definitely works using 1.2

  stylesheets:
                  - screen.css
                  - print.css: { media: print }
                  - mobile.css: { media: 'handheld,screen' }
                  - ie7.css: { condition: IE 7 }
                  - ie6.css: { condition: IE 6 }

02/18/09 11:03:45 changed by laurentb

Works with the expanded notation *and* the quotes. It's more of a parser bug - even with the quotes, the inline notation doesn't work.

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.