I can not redirect in MVC with PHP

1

I have the following files:

   <?php
    require_once "controllers/controller.php";
    require_once "models/model.php";

    $mvc = new MvcController();
     $mvc -> plantilla();

    ?>

controler.php where this template

<?php
class MvcController{

    #LLAMADA A LA PLANTILLA
    #----------------------------------------------

    public function plantilla(){

        #include() Se utiliza para invocar el archivo que contiene código html.
        include "views/template.php";
    }

    #INTERACCIÓN DEL USUARIO
    public function enlacesPaginasController(){

        if(isset($_GET["action"])){

        $enlacesController = $_GET["action"];

        }

        else{

        $enlacesController = "index";

        }

        $respuesta = EnlacesPaginas::enlacesPaginasModel($enlacesController);

        include $respuesta;

    }
}
?>

template which is the template to which redirects the first time where the links are

<link rel="stylesheet" type="text/css" href="../gestionweb/css/stylos.css"/>

<nav class="dropdownmenu">
  <ul>
    <li><a href="">ABM</a>
    <ul id="submenu">
        <li><a href="index.php?action=listarCliente">Clientes</a></li>
        <li><a href="">Articulos</a></li>
        <li><a href="">Proveedores</a></li>
      </ul>
    </li>
    <li><a href="">Nuevo comprobante</a>
    <ul id="submenu">
        <li><a href="index.php?action=claseTicket.php">Ticket</a></li>
        <li><a href="">Factura A</a></li>
    </ul>
    </li>
    <li><a href="#">Estado de cajas</a>
      <ul id="submenu">
        <li><a href="">Chequera</a></li>
        <li><a href="">Cerrar caja</a></li>
        <li><a href="">Posnet</a></li>
      </ul>
    </li>
    <li><a href="">Busqueda Padron</a></li>
    <li><a href="">Compra de stock</a></li>
  </ul>

</nav>

<table>
<caption>Ultimos Movimientos del Dia</caption>

<tr> <th>Fecha</th> <th>Hora</th> <th>Tipo Movimiento</th>
<th>Importe($)</th> <th>Subtotal($)</th>
</tr>
<tr> <td>Arándano</td> <td>49</td> <td>0.2</td>
<td>0.4</td> <td>12.7</td>
</tr>
<tr> <td>Plátano</td> <td>90</td> <td>0.3</td>
<td>1.0</td> <td>23.5</td>
</tr>
<tr> <td>Cereza</td> <td>46</td> <td>0.4</td>
<td>0.9</td> <td>10.9</td>
</tr>
<tr> <td>Fresa</td> <td>37</td> <td>0.5</td>
<td>0.8</td> <td>8.3</td>
</tr>
</table>
<input type="button"  class="botonimagenrefresh" value="      Actualizar"/>
<button class="botonimagenrefresh" value="Actualizar">    Actualizar </button>
</body>

and module-php that should redirect, the url in the browser looks index.php?action=listarcliente but does not change the content ..

<?php

class EnlacesPaginas{

    public function enlacesPaginasModel($enlacesModel){

        if($enlacesModel == "listarCliente" || 
           $enlacesModel == "servicios" || 
           $enlacesModel == "contactenos"){

            $module = "/views/modules/".$enlacesModel.".php";

        }

        else if($enlacesModel == "index" ){

            $module = "../gestionweb/index.php";

        }

        else{

            $module = "../gestionweb/index.php";

        }

        return $module;

    }

}

?>

It takes the get but does not redirect, listClient has a table and then incorporates the queries to the bd and the client class and if it works.

    
asked by Caruso 30.04.2018 в 14:05
source

1 answer

0

Apparently nowhere was he calling the method:

$mvc->enlacesPaginasController();

In fact it works now but the content of the selected view is loaded below the cover template, but it would be fixed by making a cover template ..

    
answered by 30.04.2018 в 16:32