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

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

    CRAZY CSS & PHP Problem !!


    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. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    New Zealand
    Posts
    167
    Rep Power
    14

    how about...


    If it just doesn't like including the stylesheet, could you put those styles in a text file and call it something like links.inc and then include it as a php include rather than a css link?

    like:

    <head>
    <?php
    include('css/links.inc');
    ?>
    </head>
    <body>
    Navigation info
    </body>

    I had the same problem a while back and this is what solved it for me.

    Jen
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Dallas
    Posts
    16
    Rep Power
    0
    Honestly, that is exactly how I do it, so I'm not sure what the problem could be. Is there a URL we could take a look at?

    You can look at blamm.com to see mine in action...the header file is an include function which has the css link in it, which is a file within my "includes" directory.

    - jp
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    sydney, australia
    Posts
    68
    Rep Power
    14
    hope i'm not stating the obvious but...

    where is the css directory located?

    if the include files call the css files then unless the css directory is a sub-directory of the include directory you may need to use:
    <link ....href="../css/links.css" />

    good luck
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2001
    Location
    In a multi-cultural mess.
    Posts
    569
    Rep Power
    14
    calebdzahnd,

    I know one small "quirk" between
    require ("css/links.css");
    and
    Ex: { link href="css/links.css" rel="stylesheet" type="text/css" }

    In the include case the enclosing tags
    <style>
    ...
    </style>
    must be present.

    In the latter case the enclosing tags
    <style>
    ...
    </style>
    should not be present.

    Hope it helps.

    Robert
    Robert
    ---
    If it's hard, it's probably wrong.

IMN logo majestic logo threadwatch logo seochat tools logo