Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Problem with my php dynamic CSS

    Hi,

    Because I want to change the CSS according to each page,

    I am using this to embed my CSS

    PHP Code:
    <link rel="STYLESHEET" type="text/css" href="http://www.combld.com/sites/bbcode.css">

        <style type="text/css">
        <?php require_once("$style_path");?>
        </style>

    Problem is ... it is not working in IE

    Chrome and FF pick it up OK.

    The resulting page is here:

    My Website

    My included file starts like this:


    PHP Code:
    <?php
    echo "   
    * {
    margin:0 0;
    padding:0 0;
    }"
    ;
        
    if (
    file_exists($body_image_path)) {    
        echo 
    "    
        
    #bk_image {
        position:absolute;
        top:0px; 
        right:0px;

    ...

    Any ideas ?


    Thanks.


    .
    Last edited by jeddi; 07-04-2013 at 07:44 AM.
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    63
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Would it not be better to have multiple style sheets rather than rely on PHP to generate them?

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Not really,
    because I allow the user to set font colors sizes, background colors etc.

    As I say - it works fine in Chrome and FF
    Just how to get it to run in IE ???



    .
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #4
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,235
    Thanks
    10
    Thanked 270 Times in 269 Posts
    What version of IE are you having trouble with? I checked IE9 and 10 and it looks the same as FF to me.

  • #5
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Regardless of which browser you are using, PHP instructions will be processed on the server when you request the page, and the finished product will be sent to the user afterwards. Therefore, every browser will receive the same code, so this cannot be a PHP issue.

    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #6
    New Coder
    Join Date
    Sep 2011
    Posts
    63
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by whizard View Post
    Regardless of which browser you are using, PHP instructions will be processed on the server when you request the page, and the finished product will be sent to the user afterwards. Therefore, every browser will receive the same code, so this cannot be a PHP issue.

    HTH
    Dan

    True that! Its probably a IE style issue ( especially if its ie8 or lower ), the designers I work with complain about that a lot.

    On a separate note it might be better to use PHP to change the classes on the elements rather than the CSS files themselves.
    Last edited by davidjones1990; 07-04-2013 at 04:52 PM. Reason: type o

  • #7
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    OK - you guys are correct.

    I have an old browser.

    Actually this shows something - maybe I should have a bit
    of javascript that detects an old browser and displays a notice
    like

    "Your Internet Explorer is Version 8
    For better results update your browser to IE 10"

    That would be helpful maybe ??
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.

  • #8
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,235
    Thanks
    10
    Thanked 270 Times in 269 Posts
    Far better to make your site work in any browser you expect to be used. In your case, you're using a mix of quite old html with some html5 tags. The html5 tags are only being implemented in the newer browsers. There is an "html5 shim" written in JS that you can use to make those newer tags work in IE8. That might help, and then I would get the huge number of coding errors fixed too, it probably also will affect the result.

    Dave

  • #9
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    Here is the code, to go in your head, for the HTML5 shim

    Code:
        <!--[if IE]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    HTH
    Dan
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION

  • #10
    New Coder
    Join Date
    Sep 2011
    Posts
    63
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Quote Originally Posted by jeddi View Post
    OK - you guys are correct.

    I have an old browser.

    Actually this shows something - maybe I should have a bit
    of javascript that detects an old browser and displays a notice
    like

    "Your Internet Explorer is Version 8
    For better results update your browser to IE 10"

    That would be helpful maybe ??
    Yeh thats a bad idea, you should always meet your users requirements and not make them meet yours. Besides if the user has a windows xp machine the highest version of IE they can get is 8 so you would be missing a lot of potential users.

    Also http://modernizr.com/ is a good tool for detecting a browsers capabilities.
    Last edited by davidjones1990; 07-04-2013 at 11:28 PM. Reason: Added something

  • #11
    Senior Coder
    Join Date
    Sep 2010
    Posts
    1,926
    Thanks
    15
    Thanked 229 Times in 229 Posts
    Quote Originally Posted by jeddi View Post
    Not really,
    because I allow the user to set font colors sizes, background colors etc.

    As I say - it works fine in Chrome and FF
    Just how to get it to run in IE ???
    You can do that with javascript quite easily, you can also pass the settings to a hidden input in a form and submit the form to hold the settings in $_SESSION, or you can put them in a cookie which gets called by php when you load the page. The cookie way is the best way since php and javascript can communicate by the cookie, and it can be held indefinitely. JS can make an array of the values, and when the array is written to the cookie it will appear to php as a comma separated list. So it's very simple to code and works well.
    Welcome to http://www.myphotowizard.net

    where you can edit images, make a photo calendar, add text to images, and do much more.


    When you know what you're doing it's called Engineering, when you don't know, it's called Research and Development. And you can always charge more for Research and Development.

  • #12
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    THanks for all the help.

    I want to fix the coding errors but I couldn't get the page
    to run through the validation.
    Last edited by jeddi; 07-05-2013 at 06:19 AM.
    If you want to attract and keep more clients, then offer great customer support.

    Support-Focus.com. automates the process and gives you a trust seal to place on your website.
    I recommend that you at least take the 30 day free trial.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •