Ok creo que estoy empujando a mí mismo ahora aquí, estoy createing un proyecto en mi propia MVC aún no sé lo que es en sí MVS,cuándo usar MVC en PHP?
<?php
class init
{
function __construct()
{
$this->enviroment();
$this->start();
}
function enviroment()
{
/* Required Classes */
require_once(ROOTPATH . BOOTSTRAP . REDENGINE . '/class.debug.php');
require_once(ROOTPATH . BOOTSTRAP . REDENGINE . '/class.theme.php');
require_once(ROOTPATH . BOOTSTRAP . REDENGINE . '/class.url.php');
require_once(ROOTPATH . BOOTSTRAP . REDENGINE . '/language/class.lang.php');
require_once(ROOTPATH . BOOTSTRAP . REDENGINE . '/class.sessions.php');
}
function start()
{
/* Start Classes */
$uSys = new Urlsystem;
$fragments = $uSys->getFragments();
$tSys = new ThemeSystem;
$lSys = new LanguageSystem;
$sSys = new Sessions;
/* defineing APPVIEWS & APPCONTROLLER */
define('APPVIEWS', '/appviews');
define('APPCONTROLLER', '/appcontroller');
if (empty($fragments))
{
require_once(ROOTPATH . APPCONTROLLER . '/app.home.php'); /* default app controller page */
require_once(ROOTPATH . APPVIEWS . '/view.home.php'); /* default app views page */
}
if (!empty($fragments))
{
// Start ENGINE
if (!file_exists(ROOTPATH . APPCONTROLLER . '/app' . $fragments . '.php') &&
!file_exists(ROOTPATH . APPVIEWS . '/view' . $fragments. '.php')
) {
if (file_exists(ROOTPATH . APPCONTROLLER . '/app.404.php') &&
file_exists(ROOTPATH . APPVIEWS . '/view.404.php')
) {
require ROOTPATH . APPCONTROLLER . '/app.404.php';
require ROOTPATH . APPVIEWS . '/view.404.php';
}
else {
echo "NO 404 APP || VIEW";
}
}
if (file_exists(ROOTPATH . APPCONTROLLER . '/app' . $fragments . '.php'))
{
require ROOTPATH . APPCONTROLLER . '/app' . $fragments . '.php'; // load application
if (file_exists(ROOTPATH . APPVIEWS . '/view' . $fragments . '.php')) {
require ROOTPATH . APPVIEWS . '/view' . $fragments . '.php';// load view
}
}
// End ENGINE
}
}
} ?>
Ok, como se ve mi controlador frontal , así que sé que está fallando, solo noto mi falla después de que casi termino mi proyecto, especialmente cuando necesito hacer www.someurl.com/?$getuser o www.someurl.com/myname o un usuario.
De todos modos mi pregunta es cuando realmente necesitamos MVC para PHP?
estoy mirando facebook, etc
Todavía utilizan el ?this=blabla
obtener lo que no son MVC, es así? De todos modos, todavía estoy confundido acerca de cómo Facebook lo hace www.facebook.com/myname sin él. (htaccess?)
Si no usan MVC, ¿cuándo realmente lo necesitamos?
Nota:
He leído muchos hilo acerca de cuándo utilizar MVC, pero no he encontrado uno en mi problema, si no es por favor dejar un comentario por lo que puedo leer :)
Muchas gracias.
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller – skaffman
Espero que haya obtenido la respuesta que necesitaba. –
todavía está confundido, acerca de cuando se usa mvc cuando se usa un estilo pragmático (estilo de programación antiguo) como incluir vistas de controlador (en un archivo). quizás espere 2 días o más: | . por cierto, buena respuesta AJ. Solo necesito algo de tiempo. –