Re: New to PHP, need pointers to best practices for the design of an atypical web app

From: Date: Tue, 02 Jul 2019 11:18:16 +0000
Subject: Re: New to PHP, need pointers to best practices for the design of an atypical web app
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-326841@lists.php.net to get a copy of this message
I see storing data between page views as your big challenge. Maintaining a "state" for the user session. I am guessing that you have many questions, and that means lots of data. Using a database makes sense. PHP has fine interfaces to databases. And since the application will be used by others, they need a place to install their questions. If I was tasked with this project, I would start by documenting data structures and the algorithms. (Nicholas Worth) If I understand correctly, the user navigation through the test is the tricky part. Only when this is done, would I consider the PHP programming. -- Stephen On 2019-07-01 3:45 p.m., Alan Mead wrote: > I want to implement an adaptive test (exam) using PHP. (So, like any > quiz, or any multi-page form, but using internal logic to decide what > question to serve next and deciding when the exam is done.) I am a > researcher (not a programmer) but I am familiar with Perl and other > programming languages and with some web application models. > > It looks like the vast majority of the PHP examples use the page > (perhaps with parts dynamically injected using PHP) to represent the > "mode" (state) of the application. I definitely want to separate my > logic/code from presentation, but AFAICT the popular frameworks all use > a MVC pattern where the "mode" is encoded in the URL (which is really > the same since the URL specifies the page). > > I don't think an exam fits well with either of these models. Even in > research, a test-taker completing an exam should proceed linearly > through a series of screens (consent, instructions, a series of items, > optionally some post-questionnaire questions, optionally some exam > results, some kind of "thank you"). And the examinee should not have any > ability to modify the sequence of screens or the backend/underlying data > by manipulating the URL. > > Also, one of my design goals is to allow the researcher (who would > install and configure this software) to control whether the optional > pages appear and to modify templates to include their own content on > these pages. > > My inclination is to create a large index.php file that examines the > user input and the current state and executes a subroutine that serves > the appropriate next page (by selecting the appropriate template and > filling it with appropriate information). I know this is atypical and > I'd appreciate thoughts about things I may be overlooking as a newcomer > to PHP and the PHP way of creating web apps. If I'm reinventing any > wheels, I'd appreciate pointers to those frameworks. > > I'm also having trouble finding a simple example of using a template > outside of a framework. But maybe that's my newness... > > -Alan

« previous php.general (#326841) next »