Changing css's media on <style> tag.
raphaeltsr - May 9, 2008 - 16:06
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]
<?php
print str_replace('media="all"', 'media="screen"', $styles)
?>Thanks! :)

NOTE: I've mistaken when
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>look into the drupal_add_css
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']);
Sorry but I didn't get it.
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?
check out the D5 Theme
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.