0

I used

  ini_set('include_path', '../');

to change include path and then I included

include '../header.php' ;

The problem is css files and js files do not work properly due to an error in directory!

How can I include files from other directories and keep css directories working good ?!

Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
imdhemy
  • 73
  • 1
  • 7

1 Answers1

0

We can get over that by defining a URL constant that points to the root URL, and use the variable where ever we want.

define('BASE_URL', 'http://localhost/my-app');

and include CSS files like this:

<link rel="stylesheet" href="<?php echo BASE_URL ?>/css/style.css">
imdhemy
  • 73
  • 1
  • 7