Reputation: 103
I have a dynamic about page
<section class="page">
<header style="background-image: url('uploads/<?php echo $page[header_picture]; ?>'); background-position: center;"></header>
<div class="container">
<?php echo $page['body_formatted']; ?>
</div>
and the Admin page
They both have same the same src
uploads/1473747556216.jpg
but my admin page are in a Admin folder.
How to make two different folder get resources from one folder?
Upvotes: 0
Views: 38
Reputation: 5003
Each file would need to either provide an absolute or relative path to the source file.
If your directory structure is:
root
about.php
admin
admin.php
uploads
1473747556216.jpg
Then relative paths would be:
"uploads/1473747556216.jpg" // from about.php
"../uploads/1473747556216.jpg" // from admin.php
Then absolute paths would be:
"http://whatever.com/uploads/1473747556216.jpg" // for either file
Then relative from root (if supported in your environment):
"/uploads/1473747556216.jpg" // from either file
Upvotes: 1