Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorwebguy
    • CommentTimeNov 5th 2006
     
    I'm using PHP includes and CSS for my website. Rather then having to change the directory of ever include and CSS location on each page, I would like to only change one line.

    Heres what I want to change:

    <link rel="stylesheet" type="text/css" href="<?=$location?>web.css" />
    <?php include("<?=$location?>header.php"); ?>
    <?php include("<?=$location?>footer.php"); ?>

    Where $location equals something like "../../".

    Obviously you can use PHP inside of PHP. Is there another way to do this?
  1.  
    <link rel="stylesheet" type="text/css" href="<?=$location?>web.css" />
    <?php include($location."header.php"); ?>
    <?php include($location."footer.php"); ?>
    • CommentAuthorhardy
    • CommentTimeNov 5th 2006
     
    How about setting a URI relative to the site root.

    Say your root folder is "public_html" as is fairly common. Inside that directory is your main index file, then perhaps other folders etc. Generally, I keep my css in a folder called "css" within "public_html" (at the root).

    <link rel="stylesheet" type="text/css" href="/css/web.css" />

    Starting your href with "/" starts it looking in the root directory.