Problem linking stylesheet with php

Discussion in 'PHP' started by expertwebdesigner, Sep 4, 2009.

  1. #1
    I seem to not be able to link a external style sheet in a page via PHP. When I use includes(), it seems to only print out the style sheet and not link the style sheet to the page. I have the style sheet stored outside of document root and the include() pulls but it doesn't act the way it should. Any advice on this topic is greatly appreciated.

    <?php
    $css_sheet = @include('c:wamp/www/horebgroup/CssFiles/HorebGroup_HOLDERS_CSS_FrameWork.css');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">


    #top_inside_holder{position:absolute;
    bottom:0em;
    left:0em;
    margin:0em;
    border:0em;
    padding:0em;
    width:100%;
    /*min-width:55em;*/
    height:2em;
    background-color:#d4cfcf;}
    </style>
    <?PHP "<link rel=\"stylesheet\" href=\"".$css_sheet."\" \/>"; ?>
    <title>HorebGroup</title>
    </head>


    What gets printed out is:

    body{ background-color:#ffffff; /*background-color: #cccccc;*/ position:relative; height:100%; width:100%; padding:0em; margin:0em; border:0em;} /*STARTS ALL THE MAIN HOLDERS*/ .PAGE_HOLDER{position:absolute; top:0em; left:0em; margin:0em; border:0em; padding:0em; width:100%; min-width:98%; /*width:62em;*/ height:39em; } .TOP_HOLDER{position:absolute; top:0em; left:0em; margin:0em; border:0em; padding:0em; width:100%; /*min-width:55em;*/ height:5em;} .MIDDLE_HOLDER{position:absolute; top:5em; left:0em; margin:0em; border:0em; padding:0em; width:100%; min-width:55em; height:32em; background-color:#3384fd; } .BOTTOM_HOLDER{position:absolute; bottom:0em; left:0em; margin:0em; border:0em; padding:0em; width:100%; /* min-width:55em;*/ height:2em; background-color:#f90404;} /*CLOSES ALL THE MAIN HOLDERS*/

    Any help is greatly appreciated.
     
    expertwebdesigner, Sep 4, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why are you even using PHP? Seems like you don't understand the concepts very well..

    Just replace this:

    <?PHP "<link rel=\"stylesheet\" href=\"".$css_sheet."\" \/>"; ?> 
    Code (markup):
    By:

    <link rel="stylesheet" href="http://yoursite.com/horebgroup/CssFiles/HorebGroup_HOLDERS_CSS_FrameWork.css">
    Code (markup):
    (Make sure the path is correct..)
     
    premiumscripts, Sep 4, 2009 IP
  3. yuvrajm

    yuvrajm Peon

    Messages:
    52
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Absolutely,

    you can and you should always use any script or link includes this way:
    echo "<script src=\"something.js\" type=\"text/javascript\"></script>";
    Code (markup):
    echo "<link href=\"something.css\" rel=\"stylesheet\">";
    Code (markup):
     
    yuvrajm, Sep 4, 2009 IP