Drupal 7: Randomize header background passing file name from template.php to the css file -
my scenery: have drupal 7 omega theme installed.
my issue: have set random background specific zone of css (section-header). have 4 separated css files because of responsive design, , file name same difference _mobile _narrow _normal _wide postfix. have set background in css file simple lines:
#section-header { background: url(../images/sf_header_wide.jpg) no-repeat top center; height: 390px; margin: 0; padding: 0; }
i need add more 1 image background, , know if there possible import file name external source (my template php file example) , obtain without adding background lines template.php file, because have separated css files responsive design
#section-header { background: url("../images/<?php echo $fileimage; ?>_wide") no-repeat; height: 390px; margin: 0; padding: 0; }
is possible obtain need?
i don't recommend doing way web browsers going caching css files if want change each time, not. besides that, not normal practice,
there few things instead, though. 1 within page header itself, generate style sheet so
<head> <link rel="stylesheet" type="text/css" href="primarystylesheet.css" media="screen" /> [...]all other head stuff, imports, responsive style sheet stuff here <style> /* define style after other css files imported sure loads */ #section-header { background: url("../images/<?php echo $fileimage; ?>_wide") no-repeat; height: 390px; margin: 0; padding: 0; } </style> </head>
additionally, add !important
each of css definitions (ie. height: 390px !important;
)
Comments
Post a Comment