1
I’m developing a website that I need to call a modal in the submenu of a bootstrap navbar, but the php file with the page I’d like to call is in a different folder than the file that navbar was created for. I searched a lot of sites and I couldn’t find a way that would work, someone could help me?
Code of my navbar:
public function get_menu() {
echo <<<HTML
<nav class="navbar my-nav navbar-expand-lg">
<a class="navbar-brand" href="#">Sistema</a>
<button class="navbar-toggler navbar-toggler-right custom-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Início <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Cadastrar</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item menu_item" href="#">Perfil</a>
<a class="dropdown-item menu_item" href="#">Usuário</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Consultar</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item menu_item" href="#">Perfil</a>
<a class="dropdown-item menu_item" href="#">Usuário</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Sair</a>
</li>
</ul>
</div>
</nav>
HTML;
}
Folder structure:
C: Main view project funcoes_main.php (file containing navbar, main screen) C: Project view modal index.php (modal file)
Use the code you have developed to get more help, also read https://answall.com/tour
– LeAndrade
Paste your navbar code and archive structure for better understanding so the community can help.
– ElvisP
You couldn’t call the php file that is in a different directory than the one containing the navbar? If so, put the code of the main file and how the call is being made. This would already be a 'start' for the staff can help. Note: Avoid disclosing confidential information, which may be in the code.
– Fabiano Monteiro
This will help you https://answall.com/questions/198422/footpath-to-foots-html-css-php-etc
– hugocsl
Aline here has the Bootstrap Modal documentation. If no one here answers you there for sure has the answer! https://getbootstrap.com/docs/3.3/javascript/#modals first you have to open the modal by clicking on the Menu, then make an includ to call the other page inside the modal.
– hugocsl