MVC, XSLT and other animals
The MVC architectural pattern is a smart and bright way of developing web-based applications. The acronym MVC stands for Model, View and Control: these are the three components that, according to the pattern, every application can (and should) be divided into. I would actually state that MVC is “the ultimate” way of developing apps but since IT is such a fast-growing/evolving discipline, I won’t dare being so bold and just say that it is certainly a topic every good developer should spend some time on.
This article will try to briefly expose the basics of the MVC pattern and put forward an alternative template management system based on the duo XML/XSLT. Many MVC implementations in php are actually quite fuzzy in the way they manage the Views layer. Most of them partially fail in separating the markup from the programming language and there are often some residual bits of php code here and there.
As he’ll show you in a while, it is absolutely possible (and wise) to keep the two things clearly distinct and obtain a complete separation of presentation from logic.
The goal of MVC pattern is, as stated above, to identify (divide and develop separately) the 3 layers we have briefly outlined.