Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7980547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:06:27+00:00 2026-06-04T10:06:27+00:00

Hello i have a few questions about mvc pattern and frameworks in general. I

  • 0

Hello i have a few questions about mvc pattern and frameworks in general.
I know mvc stands for model – view -controller and that models are fat and controllers are skinny but i’m not quite sure about few details .. on the view part.
let’s say for example i have this model

<?php
class Menu_Model extends Models
{
    public function listMenuItems()
    {
       return $this->query('some_select');
    }
}

controller

<?php
class Menu_Controller extends Controllers
{
   public function index()
   {
        $this->load('menu', 'Menu_Model');
        $this->view->assign('menuItems', $menu->listMenuItems());
        $this->view->add('menu.php');
   }
}

view

<div class="menu">
<li>{echo_some_data_from_controller}</li>
</div>

The above code let’s say is for a simple menu fast wrote now .. as an example. by the mvc ideea it needs to have a model a view and a controller good but then how do i implement this menu in each of the views i have? let’s pretend that:
the head.php file where i keep the import css starting of the html with basic stuff and the header of the website to get data from mysql for the menu i would need to call the model but the model is called in the controller and each page got it’s own controller so from what i understand so far for each controller method i would need to call for a certain model menu, login form etc… to output on each page i need to get data or how do i do it ?.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:06:29+00:00Added an answer on June 4, 2026 at 10:06 am

    The responsibility of a Controller is to handle User Input. If your menu doesn’t require any user input, put the code into a View Helper and then fetch the Model data from there. Then call that View Helper from the View. In other words: you dont need a controller then.

    An alternative would be to provide some sort of mechanism that allows you to register common functionality on each call to a Controller, e.g. something like Zend Frameworks’s pre- and post-dispatch hooks. You could then write plugins for these hooks to load and inject certain Model data on each request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have few questions about string literals in C++. char *strPtr = "Hello" ;
Hello I have this list that i am working on. When i move the
I have a question about best practices with the Module Design Pattern. The code
I know there are a few questions regarding the libraries you can use to
I have a few questions in trying to understand different encodings. What is the
Hello only have a few hours with Java. (from Python) I am trying to
Hello I have a table on which I have denied SELECT privs to a
Hello I have the following code namespace ConsoleApplication2 { class Program { static void
Hello I have been having trouble with this for a while now. I have
Hello I have use DOMDocs in the past but I am stuck how to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.