Skip to content
Advertisement

Why my modal window is replicated in all views

I am in the creation of a modal window but this window has something very particular and it is that I only want it to be displayed at the moment of logging in, that is, after the user enters their credentials.

At the moment I am presenting an error and it is that the window is being shown in all the views including the del login.php and the del index.php which is where I only plan to show it. I emphasize again I am only interested in showing it in the window index.phpI share below the code I have to show my modal window.

Index.php

JavaScript

The above is the code that I am using to display my modal window in index.php but this window does show up in the other views I have.

As you can see, the modal window is shown without problem, the problem is that it is being shown in all views, I hope someone can give me some guidance to solve this problem.

UPDATE 1:

This is what login.php looks like

JavaScript

Modelos.php

JavaScript

Controladores.php

JavaScript

Vistas.php

JavaScript

Advertisement

Answer

After going back and forth I realized that everything goes through the controller, that’s where I have to identify if I want to show the window or not, creating a variable in the array that I return.

JavaScript

Then in the view analyze the variable

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement