Reputation: 909
I have a prolem when I want to load bootstrap. This is my bootstrap.min.css directory:
C:/xampp/htdocs/OOPPhp/perpustakaan/bootstrap/css/bootstrap.min.css
Then, I want to load it with this code:
<link href="<?= str_replace('\\', '/', baseDir); ?> /bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
I have define baseDir before to get perpustakaan directory using this:
define('baseDir', dirname(__DIR__));
But link tag not working. I try to echo the link in href and the directory result is true. Why? This is my directory:
/perpustakaan /bootstrap /css /bootstrap.min.css /js /images /ui /header.php /listCD.php /index.php
The code is in header.php and I use include_once for header.php in listCD.php and index.php
Upvotes: 0
Views: 240
Reputation: 443
Can you try using relative path to solve the problem rather than using the basedir?
Using "../" to navigate 1 directory above.
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
Using "./" to access root directory.
<link href="./css/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
Upvotes: 0
Reputation: 2168
Try this,
<link href="<?='http://'.$_SERVER['SERVER_NAME'].'/OOPPhp/perpustakaan';?>/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> ;
Upvotes: 1