Include gets wrong path from url

3

I have the following structure:

Iwouldlikethefileinsideviews/usuarios/usuarios-view.phptoincludethefile_layout.htmlthatisinthepath:views/_template/_layout.html,I'mdoingsoinusuarios-view.php:

<?phpinclude("../_template/_layout.html"); ?>

However he takes the path:

link

When should I get the path:

link

How can I resolve this?

    
asked by anonymous 27.04.2016 / 22:08

1 answer

2

The solution found was to pass the absolute path to include as follows:

include $_SERVER["DOCUMENT_ROOT"].'/medic/views/_template/_layout.html';

For links, it would be ideal to use $_SERVER['SERVER_NAME'] :

<a href="http://<?=$_SERVER['SERVER_NAME']?>/medic/index.php"></a>
    
28.04.2016 / 20:40