Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/05/2011, 12:28
Hidek1
Colaborador
 
Fecha de Ingreso: octubre-2009
Ubicación: Tokyo - Japan !
Mensajes: 3.867
Antigüedad: 14 años, 6 meses
Puntos: 334
Respuesta: Web modular, la mejor forma con switch?

claro.. como dice gatorV... yo hago algo parecido
te dejo un ejemplo por si te ayuda a orientarte un poco

saludos.

Código PHP:
    private function _makeResponse()
    {
        
$className ucfirst($this->_request[0]);
        
$className $className 'Controller';
        
$classLocation APPLICATION_PATH '/controllers/' $className '.php';
        if (
is_file($classLocation)) {
            require_once 
$classLocation;
            
$class = new $className;
            if (!empty(
$this->_request[1])) {
                
$methodName $this->_request[1] . 'Action';
            } else {
                
$methodName $this->_request[0] . 'Action';
            }
            if (
method_exists($class$methodName)) {
                
$class->init();
                
$class->$methodName();
                
$this->_response $class->getTemplateRender($className$methodName);
            } else {
                throw new 
Khaus_Exception("Metodo $methodName no existe");
            }
        } else {
            throw new 
Khaus_Exception("Class $className no existente");
        }
    } 
__________________
More about me...
~ @rhyudek1
~ Github