0

First, i'd like to show you my directories

--themes
  -- images
      -img1.jpg
  -index.php
-index.php

My index.php (root) :

<?php
require_once '/themes/index.php';
?>

And, the index.php in the template :

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<img src="images/img1.jpg">
</body>
</html>

I think it will load themes>>images>>img1.jpg
But, it loads images>>img1.jpg which not exists.
So, I use the dirname
<img src="<?php echo __DIR__ . '/';?>images/img1.jpg">
But, instead of localhost, it use the C: directory which is forbidden

Can you tell me how to solve the problem ?

Edited by terryds

3
Contributors
2
Replies
18
Views
2 Years
Discussion Span
Last Post by gabrielcastillo
0

Do the folowing steps:

1) in index.php

<?php
require_once 'themes/index.php';
?>

2)

<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<img src="images/img1.jpg">
</body>
</html>

OR

try this

3) <!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<img src="../images/img1.jpg">
</body>
</html>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.