Jump to content

Using PHP to construct @import string to dynamically import style sheets


JohnMike

Recommended Posts

Hi All,

 

I have included some PHP code to @import in various stylesheets with in a <STYLE></STYLE> element as appropriate.

 

I know that the PHP is constructing the @import statement correctly.

 

I know that the code works perfectly when accessed through firefox.

But when accessed through internet explorer 8 the CSS is not imported.

Having messed with various snippets I am concluding that IE8 can not action an @import from within the <STYLE></STYLE> element. 

I must be missing something but I cannot see what.

I am looking at a work around but I would dearly love to know IE 8 will not run this script properly.

 

Many Thanks

This is an IE problem with HTML, nonetheless you should change the code to this. Lets say you have the following PHP code:

<style>@import('<?php echo $CSSDOCUMENT; ?>')</style>

Or similar offending code.

 

Remove it and place this in your <head> sections, wherever the template/head allows you to.

<LINK href="<?php echo $CSSDOCUMENT; ?>" rel="stylesheet" type="text/css">

 

Easy enough, and much more compatible. This is a PHP help forum, so there's some code. If you need help placing it just ask.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.