dos php incluye en diferentes ubicaciones

I have files segmented into different parts first is the config.inc.php which is located in the root dir, the second is inc/header.inc.php. When I designed the index everything worked well, but now I am starting on the first page which is located in about/index.php and everything loads with the exception of the config.inc.php I have been searching for a solution for over a hour with no luck at all. Do I just need to call the config in the about/index.php or am I missing something here all together.

I tried several solutions already involving the SERVER and getcwd(), but nothing worked.

Here is what the header.inc.php looks like

<?php
/*
 * This requires the call of the config file for the website
 */
include './config.inc.php';

/*
 * Any addition includes or script code goes below this line
 */

?>

<!DOCTYPE html>

preguntado el 28 de mayo de 14 a las 13:05

If you put in many files later when the project grows, you run into more and more trouble. 2 suggestions: Make the requested files always start from 1 file in the root directory: /all_request_start_here.php aka /bootstrap.php. From this point you include the contents, helpers, config etc. Second suggestion is to make use of SPL_autoload and wrap all the stuff into cool objects. -

try include '../config.inc.php'; -

@RakeshSharma I did try that and it broke the core index page and didn't fix the about/index.php :\ DanFromGermany I will have to research that tomorrow when I get home from work I am at the verge of exhaustion and I still have to write a document before getting sleep. -

better you have a define('BASEURL','your site url'); in common file and access all files with that -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.