Search code examples
phpcsspathincluderelative-path

Include PHP and CSS files -> relative path


Hello how can I include PHP and CSS files from another directory to the current file? Open Image

Include in mathe.php the files from php and css.


Solution

  • Looks like the php directory lies two levels below the mathe.php script. You can do something like:

    include(__DIR__ . '/../../php/navigation.php');
    

    To include the CSS files, I would start by specifying a <base> tag, that will properly anchor all relative URIs. The CSS files are read through the webserver, and will depend on what URL the document root is mapped to.