everyone. How are you all?
I'm a beginner at PHP, and I was hoping you could help me with something. I have two web applications that used to be independent from one another. Now, however, there's the need for them to run in the same server, share the same database and so on.
I thought the best (and more organized) way to do this would be to use a new index.php that require the index.php from each of these applications, but I'm having trouble importing their CSS and JAVASCRIPT correctly.
So, here's the thing:
I had two web applications with the following structure:
bower_components/
templates/
images/
scripts/
index.php
(It's actually larger than this, but the idea is the same).
I tried this, then:
webapp1/
webapp2/
index.php
(webapp1 and webapp2 both have the structure presented above).
My index.php is something like this:
<?php
require_once 'webapp1/index.php';
require_once 'webapp2/index.php';
?>
That... Somewhat works. But then the applications can't correctly import the files from bower_components, for instance. These files are imported in a header.html file located in templates folder. The code is something like this:
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<script src="../bower_components/owl.carousel/dist/owl.carousel.min.js"></script>
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
Used to work just fine when they were, in fact, independent. Now, not so much.
It would work if I changed these to:
<script src="../webapp1/bower_components/jquery/dist/jquery.min.js"></script>
BUT!! I don't want to do that. It's a lot of changes to be made, across a lot of files, there has to be a simpler way.
Anyway, so sorry for the long question, hope it was clear enough. So, is there a way to do this without changing the html files?
Thank you in advance.
Additional notes: I'm running them in the simple PHP built in server, but have Apache available (just didn't want to use it). I'm using SLIM framework in one of them.