#1
  1. No Profile Picture
    Just Another Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Middle America
    Posts
    41
    Rep Power
    13

    Crazy PHP and CSS Dilemma


    this problem deals with using linking style sheets AND php includes at the same time.

    it is kind of hard to follow. might be best to grab a sheet of paper to map this one out.
    here we go...

    i have a web site that uses PHP includes to deliver most of the content on the site. Ex: "index.php" includes "includes/navigation.inc.php" and "includes/titlebar.inc.php". These include files use linking style sheets that are in a different directory. Ex: { link href="css/links.css" rel="stylesheet" type="text/css" }

    This does not seem to work, however. It seems that the PHP includes do not call the stylesheets and when i try to link it from my index.php page, it still seems to do nothing.

    Am I doing something wrong here? Any kind of special syntax? Any correspondence or help would be GREATLY appreciated!!

    Going Crazy
    caleb
    caleb@jsoftintl.com
  2. #2
  3. phpkid ~~~~~~ :o)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Nov 2000
    Location
    NJ, USA
    Posts
    2,534
    Rep Power
    16

    Post i think ..


    i think there is something wrong regarding ur concept.

    basically PHP is used to out put HTML.

    now its upto u what HTML o/p to produce.

    suppose that u r writing this

    link href="css/links.css" rel="stylesheet" type="text/css"


    then it will look for links.css as u have put in normal html page. it has nothing to do with PHP.

    make sure that there is css directory under directory where PHP script is residing..

    i think best approach would be to use absolute path for css file. that should work for sure,

    jd
    _____________________________
    d.k.jariwala (JD)
    ~ simple thought, simple act ~
    I blog @ http://jdk.phpkid.org
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Washington, D.C.
    Posts
    1
    Rep Power
    0

    link your css/


    Try creating a link for the absolute path and use that in your link to the stylesheet :

    $path = "/home/sites/home/web/yoursite";

    link href="<?php echo $path; ?>/css/links.css" rel="stylesheet" type="text/css"

    That will solve the problem of incorrect paths.

    It's really a matter of how you want your directory structure set up.

    cheers -

    Comments on this post

    • Gran Roguismo agrees
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2001
    Posts
    25
    Rep Power
    0
    Try cdogg's method with the include() function and include stylesheets written just as if they were embedded in the page.

IMN logo majestic logo threadwatch logo seochat tools logo