PHP recursive directory

Asked

Viewed 124 times

0

I need to include a file from a recursive directory, I’m using the following form:

<?php 
  require_once '../../cabecalho.php';
?>

Okay, here’s what’s going on. The header, which would be the header of the page + menu is loading, however, only the HTML, everything that is referenced within the header, as for example:

<link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/> 

is not carrying, help?

  • 1

    Looking like this, it seems that the path of your css is not being located.

  • 1

    What exactly is a "recursive directory"? I’ve now searched two search Engines, and only your question came up with the exact term.

1 answer

0


To work this way, the css, javascript, or image path must be relative to the page that is including the header and not the header itself.

Or alternatively, you can use the absolute path to include the files, for example:

<link href="http://seuservidor.com/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/> 
  • Based on the root is even more practical: /css/materialize.css

  • Exactly. I put it that way because there are some local servers like localhost/webdav/project, etc. that can give error. But to use online is the best option

Browser other questions tagged

You are not signed in. Login or sign up in order to post.