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
--
Alan D. Mead, Ph.D.
President, Talent Algorithms Inc.
science + technology = better workers
http://www.alanmead.org
"You're an interesting species. An interesting mix.
You're capable of such beautiful dreams, and such
horrible nightmares. You feel so lost, so cut off,
so alone, only you're not. See, in all our
searching, the only thing we've found that makes
the emptiness bearable, is each other."
-- Carl Sagan, Contact