As a common CMS is a quite big application, I don't think you can find
any valuable tutorial for stuff like this. But if you want to build an
application with a flexible and smart template and module engine,
google for "MVC" or "model view controller pattern".