bdmovies Posted January 11, 2009 Share Posted January 11, 2009 I'm trying to pick up the MVC concept. I'm also working on a project where I think this very ideology may help. I need to give my clients a way to create custom reports or configure certain reports to look (or contain certain data) the way they want. I've decided the best way to do this is to export the database query as xml and then let the clients create/edit xslt files. I do not want (nor really can for scalability reasons) to create an xml file for every possible query. I'd much rather create one php file that has a massive list of possible results and based on the controller (??) it calls the correct function and outputs the results as xml. Does this sound like a viable solution? Here is an example. If the client needs AccountingReportA they would open AccountingReportA.xsl. Somehow xml.php gets called perhaps with ?report=AccountingReportA. From there, the a new xmlExport object is created and the AccountingReportA function gets fired. Does this make sense? I think I've got the idea down, just not the implementation. Quote Link to comment https://forums.phpfreaks.com/topic/140364-mvc-101/ Share on other sites More sharing options...
dbo Posted January 11, 2009 Share Posted January 11, 2009 MVC is a design pattern which promotes separating business logic, from presentation, from data access/manipulation. There are a ton of ways to implement such a pattern, but usually when you go asking how you get into philosophical debates where no one wins That being said you can get a good idea of one implementation by reading CodeIgniter's user guide. It has good documentation with very clear/simple examples. They however have a somewhat loose approach to how it's implemented which gives you a little more flexibility with your approach. A common implementation looks like this: Request comes and is handled by the front controller (or router) which dispatches the request by automatically invoking the appropriate controller. Depending on the action parameter that is passed in the appropriate controller method is called, which then calls the model(s) to fetch data and then populate the appropriate view(s). After all this work is done it gets barfed to the screen for the user. As for your reporting needs and whether or not this is a good approach... well I dunno enough about your situation, but having end users create/edit xslt files would not be acceptable in my book. Have you done any research on packaged software? Have you looked at Crystal Reports? Have you looked for even PHP software that might attempt to solve this problem? Take it from someone who just witnessed an organization who generated all of their reports via DTS packages (about 1250 actually). It can easily turn into a real nightmare. Quote Link to comment https://forums.phpfreaks.com/topic/140364-mvc-101/#findComment-734832 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.