The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/printthread.php 16 require_once



UserSpice
MVC-lite structure - Printable Version

+- UserSpice (https://userspice.com/forums)
+-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28)
+--- Forum: Off-topic Discussions (https://userspice.com/forums/forumdisplay.php?fid=10)
+--- Thread: MVC-lite structure (/showthread.php?tid=240)



MVC-lite structure - plb - 09-06-2016

I am in a situation where I have the same data which must be presented in various different ways.

Has there been discussion about the best way to structure US so as to implement a lite version of MVC or at least separating the "view" from the "data collection"?

Basically I want the same SQL queries to be used for 2 different views. I could implement the 2 different views in a single script with a lot of complicated and hard-to-read conditionals or I could "require" the query stuff from a separate script but both seem forced and awkward...


MVC-lite structure - mudmin - 09-06-2016

UserSpice is pretty agnostic as to what you do with the pages it controls. My initial thought is that it makes the most sense to create the logic in your base file and then require in the views based on an if statement. I think that would produce the most readable and least redundant code. That's just my 2cents.