0

I'm trying to learn how to make a PHP app using an MVC architecture. I've created a basic app based on a tutorial which just has a model, a view and a controller for each page group (such as site.com/index, site.com/account and so on).

My problem now, is that I can't figure out how I would make something more complex. Say, I want to make a calendar app, in which the user sees a calendar on their account page when they log in.

Would I create a model and view for the calendar, and then get the required calendar data by including the calendar model into the account page controller?

How about when rendering the calendar, would I include the calendar view into the account page view and then use that to generate my calendar layout?

6
  • 2
    If you're not an expert, why don't you use a framework? Commented Oct 18, 2011 at 13:31
  • 1
    If you are an expert, use a framework anyway =) Commented Oct 18, 2011 at 13:34
  • MVC is not an architecture, but a design pattern Commented Oct 18, 2011 at 13:35
  • @Interstellar_Coder MVC can be a design choice in an architecture but its not an architecture. And I am not answering that because we got lots of questions and good answers explaining various MVC implementations. Commented Oct 18, 2011 at 13:40
  • being an architectural pattern does not make an implementation of it an architecture. it still just a pattern; a web presentation pattern to be precise Commented Oct 18, 2011 at 13:42

2 Answers 2

1

You have a pretty good idea i would say. Think of the calendar view as a "partial view" basically it's not a full html page, just the calendar in a div. You would include this partial view within the account view and pass in the data as needed. Yes, you can grab the calendar data in the account controller using the calendar model, this data can then be sent to the account view and further passed on to the partial calendar view.

Sign up to request clarification or add additional context in comments.

Comments

0

It really depends on how you setup your app. You may be able to just include() the proper files, and then call their methods or functions to work w/ your data. Did you app use any sort of naming convention? If so you may need to name your controllers and model something specific and define relationships between the data inside of the models.

Either way some code samples would probably help us provide a more definite answer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.