php,css page delay

Discussion in 'PHP' started by rojojat, Nov 30, 2008.

  1. #1
    Hi,
    The code below works fine. When the page is displayed in the browser there is a split second where the page is displayed without the css effects,and then its displayed properly. Does anyone know what could be causing that short delay?
    Thanks.






    <?php
    session_name('f1');
    session_start();
    ob_start();
    // Authorization check
    if (!isset($_SESSION['user']))
    {
    $redirect_url = "access_denied.html";
    header("Location: $redirect_url");
    }
    ob_end_flush;
    ?>
    <html>
    <head>

    <title>page1</title>
    <style type="text/css" media="all">@import "layout2.css";</style>
    </head>

    <body><p class="first"><?php echo 'Hello ' . $_SESSION['user'];?></p>

    <div id="Header"><a href="">My Account</a>&nbsp;&nbsp;<a href="">Profile</a>&nbsp;&nbsp;
    <a href="">settings</a>&nbsp;&nbsp;<a href="">Contact</a>&nbsp;&nbsp;<a href="">Resources</a>&nbsp;&nbsp;<a href="">Help</a>&nbsp;&nbsp;<a href="">Log out</a></div>
    <p class="second">Welcome to the My Account page. The only way you can access this page is if you are <br>
    a registered user who has activated there account.</p>
    </body></html>
     
    rojojat, Nov 30, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The css file hasn't loaded yet. File should be cached after first load.
     
    matthewrobertbell, Nov 30, 2008 IP
  3. rojojat

    rojojat Peon

    Messages:
    43
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think I solved the problem
    replaced <style type="text/css" media="all">@import "layout2.css";</style>
    with <link href="layout2.css" rel="stylesheet" type="text/css" />
     
    rojojat, Nov 30, 2008 IP