Hello,

I'm working on a mobile version of my websites and I need to change the media of the other css that the drupal already provides. They're all displayed as follows:

[code]

@import "style.css";

[/code]

Is really any better way then:
[code] print str_replace('media="all"', 'media="screen"', $styles) [/code]

Thanks! :)

Comments

raphaeltsr’s picture

NOTE: I've mistaken when posting the codes. Here's the correction to the first code.

<style type="text/css" media="all">@import "style.css";</style>

arh1’s picture

look into the drupal_add_css function, and its return value. check out the notes on the 4.7 -> 5.x theme upgrades handbook page and the function's page on the API site.

specifically, you'd want to do something like this within the _phptemplate_variables function in your theme's template.php:

$vars['css']['screen'] = $vars['css']['all'];
unset($vars['css']['all']);
raphaeltsr’s picture

Sorry but I didn't get it.

Do I have just to post it on my template.php and it's done?! :O

Could you please give me a better look on that?

arh1’s picture

check out the D5 Theme Developer's Guide, and specifically the Making additional variables available to your templates to learn about the _phptemplate_variables function. within the page hook you'll want to add code like the above.