[PHP] Including a file from root directory when i'm in /music/lyrics
The topic should be self-explainable.
In the file /music/lyrics/forsta_ronden.php i want to include the files header.php and footer.php whos is in the root directory.
I've tryed
PHP Code:
<?php include 'header.php'; ?>
<?php include '/header.php'; ?>
<?php include '/../header.php'; ?>
<?php include '/../../header.php'; ?>
But none of them worked, i get the same error;
Code:
Warning: include(/../../header.php) [function.include]: failed to open stream: No such file or directory in E:\xampp\htdocs\the_old_farm\music\lyrics\forsta_ronden.php on line 2
Any suggestions?
Re: [PHP] Including a file from root directory when i'm in /music/lyrics
PHP Code:
<?php
include "../../header.php";
include "../../footer.php";
?>
Re: [PHP] Including a file from root directory when i'm in /music/lyrics
It worked, but the links and the css got fucked up now.
The links are linking to pages in the music/lyrics directory and the css don't show up, in header.php i used
PHP Code:
<link rel="stylesheet" href="images/style.css" type="text/css" />
EDIT:
Fixed the links by adding "/" be4 them in header.php
Re: [PHP] Including a file from root directory when i'm in /music/lyrics
PHP Code:
<link rel="stylesheet" href="../images/style.css" type="text/css" />
Re: [PHP] Including a file from root directory when i'm in /music/lyrics
I usually just add a '/' to it.
I've had a problem with CSS too when I used mod_rewrite to make blabla.php into /blabla/ (e.x).