Author Topic: Some changes to TinyMVC  (Read 1741 times)


  • Guest
Some changes to TinyMVC
« on: November 19, 2010, 04:12:55 am »

I have made some changes to TinyMVC that suit my needs a little better and decided to share them with you to hear your opinion.

1. I created a new class which I called System_Runner to do the url parsing and the call for the controller action function.

2. I moved the initialization part of the tmvc object in its constructor and made the Controller object to extend tmvc object and added the load class to tmvc object not to Controller as it was.

So in index.php I have this:
Code: [Select]
$Sys_Runner = new System_Runner();

The reason for doing this is because I wanted to be able to load models and libraries in controller constructor which is very useful in some situations and also when I use the load method in libraries I write only $tmvc->load->.... not $tmvc->controller->load , as it was which is shorter and clearer I think.

What do you think about this? If you are interested I may post the complete code here.


  • Administrator
  • Sr. Member
  • *****
  • Posts: 275
    • View Profile
Re: Some changes to TinyMVC
« Reply #1 on: November 19, 2010, 08:35:13 am »
normally one and only one controller is loaded on each request, so that is where you would do your library loads. You can also autoload libraries from the autoload config.