Jump to content

MVC Architecture from ground Zero


leulae

Recommended Posts

I began to learn PHP and now in I can do something, Now I want to move to my development method to MVC (MVC architecture)

I want to develop it by myself, I learned through web sites.  But I couldn’t grasp the idea well,

Please help me to build and understand

 

How can I implement this? (Imaginary problem)

 

When someone not logged he should display the login screen, after authentication he will display the main screen, there are two links to two separate pages. One page displays a form to enter Name, age and sex (Will call it privateInfo page) and the other page displays list of persons entered using page one.  (will call viewAll page)

 

I want to identify the classes, for M V C and implement the code using php, guide me to start

 

If you have good simple examples direct me

 

Thanks in advance

 

Leulae

Link to comment
Share on other sites

First off MVC is not

 

When someone not logged he should display the login screen, after authentication he will display the main screen, there are two links to two separate pages. One page displays a form to enter Name, age and sex (Will call it privateInfo page) and the other page displays list of persons entered using page one.  (will call viewAll page)

 

Nor is it directly related with OOP

 

I want to identify the classes, for M V C and implement the code using php, guide me to start

 

If you have ever used something like

 

/profile.php

/register.php

 

In which you used functions to perform the task and then render a template using a template engine. You in fact had an MVC implementation.

 

Creating an effective MVC OOP implementation is not so simple as you might think. You don't just create an abstract class (or interface) for Controller, Model, and View. Like any project should you give this some serious thought as what do you want to build? How is this all connected? Do all entities have a clear SoC (Separation of Concerns) and do all of them have a SR(P) (Single Responsibility Principle).

 

So, let me start by asking: what do you want to build?

Link to comment
Share on other sites

So, let me start by asking: what do you want to build?

 

I want to build (Need Skeleton)

1. My own MVC framework

2. Add login page

3. Data Entry form – (eg: Name, Age, Sex)

4. View Page (List of above 3)

5. Restrict enter or view data without logging

 

I like to implement this in OOP style, Then how to start, thank you all in advance

 

 

Leulae

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.