Jump to content

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


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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.