0

My server web directory structure is like

/www/site1/
    js/
    css/
    partial/
          -head.php
          -footer.php
    view/
         -page1.php
    -index.php

/www/site2/

head.html includes js files like

<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/bootstrap.min.js"></script>

head.php file is included in index.php and view/page1.php.

It works fine on index.php but not on page1.php because of the path of js files. On index.php path becomes like

/www/site1/js/jquery.min.js

On page1.php path becomes

/www/site1/view/js/jquery.min.js

How to include js on head.php so that it works fine when included in index and page1

Pete
  • 57,112
  • 28
  • 117
  • 166
John Wick
  • 29
  • 1
  • 1
  • 7

1 Answers1

0

Try add slash to source

<script src="/js/jquery.min.js"></script>
<script src="/js/jquery-ui.js"></script>
<script src="/js/bootstrap.min.js"></script>
Fky
  • 2,133
  • 1
  • 15
  • 23