Hello,
I 'm writting an application using an MVC approach of mine (not with a
framework). Notice that I 'm not writting a framework but an application
with such an approach.
I 'm having trouble understanding how views work. I have understood
(from web reading) that MVC is a flexible approach and not something
strict so I want some advice.
I have index.php as a front controller. Depending on the module being
asked (index.php?modu le=professors for example) I load an appropriate
class controller.
Then in index.php I have a $controller->Process() function and a
$controller->view->Display() where view is a view defined in the controller.
But how do you define a view? Lets assume I am a teacher with a login in
the system and visit the site. A login in form should be presented upon
first visit to login. Is this a view by itself? Then if you login you
are shown a menu and a default page. This page holds a list of notes you
have uploaded, and you can upload/delete/edit the data. Is this a page a
single view? And what about the menu of the user. Is it a separated view
included from the main view?
I find it a little bit complicated to undestand. And to give you an
example this is my view now:
class gView {
var $header;
public $title;
public $jsscripts;
public $metakeywords;
public $metadescriptio n;
public $todisplay;
function header(){
$title=$this->title;
include('static pages/top.php');
}
function footer() {
include('static pages/footer.php');
}
function Display() {
$this->header();
print $this->todisplay;
$this->footer();
}
}
The $controller->Process() function loads the appropriate function and
sets the $view->todisplay string. Just to clarify that each controller
holds also the buisness model is the class. I don't use a separate model
class for each controller.
Any help/hint would be valuable.
Thanks a lot
Harris