0
I am developing a system, in some files I came across a lot of codes in JS
inside my files of PHP
and a large amount of modals
bootstrap also.
But what’s the problem?
I know that the correct thing is to keep the files of each language separate from each other, but I believe on account of organization. And I started to feel uncomfortable with it, and I decided to try to organize in a better way.
At the end of my HTML page, I used these 2 codes:
<!-- Incluindo modals utilizados nessa página -->
<?php include('organizacao_paginas/Modals/painel-admin.php') ?>
<!-- Incluindo scripts e funções utilizadas nessa página -->
<script src="organizacao_paginas/JS/painel-admin.js"></script>
Apparently the first include
, is working normally, I can open the modals and etc.
But the <script src=...>
no longer is, all functions of this page, do not work, I have tried to put the same inside the <head></head>
and also use its own include
, but without success.
How can I be including this file JS
so that it works normally?
I’m sorry if I said something incoherent, you can correct me and thank you all from now on.
It’s probably a problem as your relative path
src
.– Wallace Maxters
Ever tried to put a . / before the path in the script?
– Thiago Maurer
Related: Difference between absolute and relative Urls in page contents
– Luiz Felipe
Already yes, without success.
– Web Developer
Can send print with folder/file structure?
– Thiago Maurer
@user210741 you would need to show the directory structure that this file(s) (s) is. Do they run from any subfolder? If yes, it may be the problem, but it gets hard to do without knowing more details.
– Wallace Maxters
@Luizfelipe tried to use the 3, but without success...
– Web Developer
@Wallacemaxters I’m surprised, because the 2 files I’m trying to include, is in the same folder, and only 1 is working. View the folders
– Web Developer
An interesting solution is also to use an architecture standard to keep the code cleaner, you can opt for example for MVC, is a great solution!
– Ivan Fuhr
I’ll do a search, thanks! @user210680
– Web Developer