0
Hello, as a matter of organization I wanted to do one thing, all the files stay in the root folder for example:
htdocs index.php by organization I wanted to learn how to do so: htdocs template index.php
and all who request other url will read all files from the templates folder for example: htdocs template pagina2.php htdocs template pagina3.php and so it goes.
Then it would look like this:
meusite.com/pagina2
but I don’t know how, with include didn’t work out so well
my php index.:
<?php include ''.$_SERVER['DOCUMENT_ROOT'].'/template/'.$_SERVER["REQUEST_URI"].'.php';
my index.php template folder:
<!DOCTYPE html><html><head><title>Bem vindo ao site</title</head<body>Teste</body></html>
I tried it the way up but it didn’t work
You checked the value of
$_SERVER["REQUEST_URI"]
before trying include? Only concatenating will leave the right file path?– Woss
You can change your web server to use the template as root directory as well.
– gmsantos
Anderson I tried in some ways and they all went wrong even with if, gmsantos, I’m mounting a public cms so are different servers that will use
– Victor Stanford