Hi
I have a lack of understanding how root folder works, together with the option "include" files in different folders.
This is my simple example (I taylored the problem):
I have index.php in the root folder.
<!DOCTYPE html>
<html lang="de">
<?php include "./phpadds/head.php"; ?>
<?php include "./phpadds/header.php"; ?>
<body>
<h1>Hello</h1>
</body>
</html>
Here both include order (head.php and header.php works fine.
header.php
</header>
<div>
<a href="./index.php"><span class='Ub2'>Home</span></a>
<img src='./src/img/favicon/new.jpg' alt='Neu' width= '35'>
</div>
</header>
head.php
<head>
<link rel="stylesheet" type="text/css" href="./src/css/styles.css">
</head>
The styles.css is defined in head.php and works too.
h1 {
text-align: center;
color: red;
}
Now i create a new folder "google", there in copy the index.php from my root (root(google/index.php).
Now both includes are not working, because they are not pointing to the right place.
<?php include "./phpadds/head.php"; ?>
<?php include "./phpadds/header.php"; ?>
I can change them to:
<?php include "../phpadds/head.php"; ?>
<?php include "../phpadds/header.php"; ?>
Now, header.php is visible, but then still styles.css and all other links inside head.php and header.php are not working, because the point to the false folder (./)
What do I have for possibilities to manage this behaviour, so that links and includes are working ?
Root on my local server and on my hosting server is not the same.
Yves