title: Model view controller: Sending regularly displayed information to the view from controller
body: <p>I have previously asked this question but didn't get an answer. I'm trying to learn model view controller pattern and developing a simple framework for learning purposes.</p>
  
  <p>I understand it is hard to adopt mvc pattern to php and most of the popular frameworks use mvc variations (including myself), not the actual pattern itself. In most of these variations: controller gets input from the user and sends it to the model, model process this input and gives a response back to the controller and in final step, controller chooses the appropriate view and sends information to this view based on model's response.</p>
  
  <p>In my design, controllers use a view instance that simply look like this:</p>
  
  <pre><code>class view {
      public function render($filename){
          require_once "templates/$filename.php";
      }
      public function addData($key,$value){
          $this-&gt;{$key}=$data;
      }
  }
  </code></pre>
  
  <p>In this context, what is the best way for the controller to send regularly displayed information to the view?</p>
  
  <p>To give an example, let's say we have a social network application which has a top menu that displays notifications to the user. This menu is, core part of the view and being displayed on <strong>every page of the application</strong>. To my understanding, this means that once the user is logged in to the application, controllers must add notification information to the view instance in every action method. </p>
  
  <p>I was wondering if there is a more elegant way to do this.</p>