MVC - 共同功能的地方?

I've just started to look into MVC and I'm pretty new. I would like to port procedural code across to it but I'm struggling (please no-one suggest to use a Framework).

I can understand how it works, but understanding is different to doing. In my procedural code, I have several functions such as message(). These are called if the user does not have permission to view the current page, for example.

My problem is adding this into MVC. I've added Twig so far and I've managed to render some Twig on the index page but using functions such as message before was as easy as this:

message('Message Text');

Adding it to the controller directory would allow it to be accessed as a web page, which I don't want. And through the model, I'm not sure how to do this without requiring the file first. I could use a function, but I don't want globals and this is partly why I'm changing.

How can I properly place commonly used functions?

Edit

What I'm using is a modified version of this: http://www.phpro.org/tutorials/Model-View-Controller-MVC.html

I tend to think of traditional MVC like this:

A controller is my business logic to implement my product.
A model is the code to represent data.
A view is what represents my product.

Under this paradigm, what represents my product is what an end-user sees. So if it's a UX component, it's part of the view.

In this way, it's pretty easy to figure out how to use it:

  1. You could use path/to/notifications.php and then $notifications = new Notifications(); where notifications.php is a class facilitating messages like you reference.
  2. You could extends Notifications on your view (or even a base view!) so that ANY view you instantiate immediately has access to your notifications class.
  3. You could (though probably shouldn't) require_once( 'path/to/notifications.php' ); and then the class or functions therein would be available. Again, you probably shouldn't do it this way

The bottom line is this:

  • Place your old procedural code in a well organized class. It might be named something like Notifications if that's what the code does. The important thing is to organize well, name well, and do not try to force too much code into one thing.
  • Use that class in your code. You can explicitly use it's namespace and new an instance of it, or you can extend it to bring it along as the parent class of your view.