Separating data from program in Lectora

mlapl1 Community Member Posts: 349
As we all know, a Lectora title consists of a user interface etc. and content (varying from text to media). In other words, everything is mixed together in a title which is then compiled and presented. It works nicely and attractively but every time you want to change lesson content you have to re-compile everything.

It would be nice if like with other lesson interpreters, we could create a template which would not need to be changed but which would read in its data from, say, a text file or files or perhaps a database.

So... my question is... Has anyone tried to do this and, if so, how did they do it?

I know that there is the dynamic text option - and perhaps one might use that - but there may be other options too.

Any thoughts anyone? Thanks!



  • approg
    approg Community Member Posts: 258 ♪ Opening Act ♪
    I'm not sure what you're asking.

    Do you want one "server" lectora title which is also the UI and then a series of separate "client" lectora titles, each of which is a single page of content? Together they form one course with the master title individually serving the client titles as required.

    I think it's a nice idea but I see it causing more problems that it solves.
  • mlapl1
    mlapl1 Community Member Posts: 349
    Hello @approg

    Thanks for the feedback. No, that is not what I want to do.

    As I said in the subject line, I want to separate the program from its data so that I can modify the data externally from the program itself.

    If I were writing my lesson, e.g. in C, I would have a lesson interpreter consisting, say, of a template with a structure that looks like:
    (a) get the question text (from an external text file or database on the web server)
    (b) display the question
    (c) read the student's answer (e.g. short answer format)
    (d) read the possible answers (from an external text file or database on the web server)
    (e) compare the student's answer with the possible answers
    (f) read the feedback to the student's answer (from an external text file or database on the web server)
    (g) display the feedback
    (h) Eventually move on to the next question
    Of course, in real life, the sequence described above would probably not occur as shown and all the information for each question would be read in once at the beginning of the  sequence.

    In other words, we have a giant loop which displays and manages information (and judges responses) which is stable and repetitive but which brings in new data with which the student will interact after completing each question. Just a standard programming structure.

    Lectora can produce nice UI and in at least *some* instances, the structure that I describe could facilitate rapid production and deployment of learning materials by non-Lectora programmers, with people filling-in an online form which might have fields as below:
    (a) Question header and text
    (b) Expected correct responses
    (c) Expected incorrect responses
    (d) Feedback for incorrect responses etc. etc. depending on the answer-evaluation and feedback mechanism in place.

    Lectora specialists would generate the template as a Lectora title. This will save time and energy and reduce the need for Lectora expertise while maximizing the delivery of Lectora titles. It would also reduce the bulkiness of the Lectora title. You could have hundreds of questions serviced by one Lectora page - instead of hundreds of Lectora pages all of which would increase the risk of making mistakes - let alone the problems of updating them.

    In summary, Lectora produces the UI in a title but the lesson data comes from somewhere else (and can be modified without accessing the title itself). Also... there is only one title which cycles through new data.

    I am aware that in a sense this contradicts the logic of Lectora which is supposed to make lesson-writing "easy" but for me what is really really difficult is the UI - and Lectora does make that easy. I like Lectora because you can at least, in some sense, get "into" the system with JS and its passing of variable to JS and also connect to databases even in a rudimentary fashion.

    Hope this clarifies things a bit - and I was wondering if anyone has actually attempted something like this and how they had achieved it.

    Apologies for this long answer.

  • approg
    approg Community Member Posts: 258 ♪ Opening Act ♪
    Oh, ok so you're just talking about an assessment in which all the questions are multiple choice type of questions (questions that can easily be described in a text format) that cna be read from a database.

    First, you need to work out in detail how you want it to work, For example:
    • Read from a database (what database, what server side language... how will that work in an LMS...)
    • What types of questions: multiple choice, multiple response...
    • What attributes: randomise options, question banks, question weight, time limits...
    • What limitations on the display eg. the Lectora template may only accept a maximum of 5 options each a maximum of 120 characters.
    • What properties eg. number of questions to display; the pass mark...
    • Additional features eg. users to repeat incorrectly answered questions
    • What happens if a user reloads the page? Does it cause the whole thing to be reset?
    • What browsers will you target?
    • Will it be RCD?
    I think it's doable but once an instructional designer/user gets involved (and I think they should be involved early) they will "crush" you under the weight of minutiae. That is, it's more than a six month project.

    If I was going to attempt something like this, I probably wouldn't consider using Lectora.
  • mlapl1
    mlapl1 Community Member Posts: 349
    Hi again and thanks for your detailed answer. Actually, I am specifically not talking about multiple choice questions/quizzes, but you are right in that the question information would be drawn in text format from somewhere. Second, most of the concerns you voice are obviously really important, particularly if one were to create a generalizable system.

    Actually, my main concern was/is how does one read a simple text file into Lectora? Just bring it in with JS I guess but I was looking (perhaps mistakenly) for a "Lectora solution". Having said that, reading from a database is provided as simple, more secure and a better "Lectora" solution.

    Having said that, I would appreciate knowing if/how Lectora can read from a text file without going to JS etc.

    So... @approg thank you for helping me with this issue. I hope you did not find this long conversation too much of a waste of time. It has been really useful.


  • klaatu
    klaatu Community Member Posts: 988
    Andrew, you can use JSON.
  • klaatu
    klaatu Community Member Posts: 988
    I don't mean to make that sound easy. What I should have said was that it should be possible using JSON. It sounds like an interesting challenge.
  • approg
    approg Community Member Posts: 258 ♪ Opening Act ♪
    Darrel, Andrew does not want to use JavaScript so how do you propose that the JSON be read by Lectora. And, having read the JSON, how are you possibly going to build a Lectora question (given how interdependent Lectora's question code is)?
  • mlapl1
    mlapl1 Community Member Posts: 349
    Hi Darrel

    Thank you! Nothing is easy in this business - at least as soon as you need to move slightly off the beaten path! I will keep it in mind.
  • mlapl1
    mlapl1 Community Member Posts: 349
    It's not that I don't *want* to use JS/JSON. I would like to avoid it if possible. In working on this project I would like to discover if Lectora has built-in functions for achieving the same functions. I would like to understand the limits of Lectora. If Lectora has already done (all or some of) the work, then why do it again. The other thing that needs to be made clear is that, for this application, I am not (necessarily) interested in the Lectora question set - more the UI generated by Lectora.

    I know that many Lectora users want/need ready-made question types. I think that the Lectora question set is fine, but for the purpose that I have in mind I do not need this and will write/have written dedicated answer-evaluation routines either in JS or using a PHP back-end. I am also not interested in portability across devices - at this stage (I know  I should be). I am focusing on PC-based work.

    I hope that this makes sense...
  • approg
    approg Community Member Posts: 258 ♪ Opening Act ♪
    Andrew, I really want to help but each time I try the question changed.

    Good luck.
  • mlapl1
    mlapl1 Community Member Posts: 349
    Thanks @approg - didn't realize I was doing that but I think you have answered my question. You have been very helpful. Thank you and sorry for any confusion.

    All the best!
  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    Interesting thread for sure Andrew.

    Some things i did in the past that work, but offcourse getting it right is quite some work.

    Use a realtime database like 'Firebase', read/write data in and out of Lectora.

    Because Lectora.awt is xml, you can generate a Lectora title ( from scratch ) based upon a proper setup Photoshop file.
    Use Javascript to get data in ( Fabric is a library i like ) and let the user change appearance of the course.

    I like the possibilities of what you are asking Andrew, would love to team up with several of the brainiacs of the community to get something like this happening....


  • mlapl1
    mlapl1 Community Member Posts: 349
    Thank  you Math. I will try to make it happen. I actually want something very simple. I think that maybe people have over-complicated things - but thanks to today's conversation I think I have an answer. We'll see I guess.

    And working together is, of course, a great idea.


  • mlapl1
    mlapl1 Community Member Posts: 349
    Although I think I solved my problem, I may have confused people  by the way I wrote - sorry...
  • ahetherington9113
    ahetherington9113 Community Member Posts: 132 ☆ Roadie ☆
    Hi Andrew,

    Have you considered using the Translation function in Lectora? I'm not sure if I understand your requirement exactly, but if you were to export text, change the text and then import the text back in using the Translation function, perhaps you could achieve what you're looking for? Without translating the text of course...

    So, you could create a template, and then various text files that could be imported as required.

    Please disregard if I've missed something..


  • mlapl1
    mlapl1 Community Member Posts: 349
    Hi Amanda

    That sounds like such an  intriguing idea. I would never have thought of that.

    I may try it but actually have solved my problem in a different way, by simply downloading text information from a database into one or more Lectora variables which are then processed in Javascript and through a series of run JS actions or whatever. This will allow me to have a consistent user interface with the ability to vary content and with no interference with the Lectora files themselves.

    Actually, I do have another question for the community related to the above but will probably start another thread.

    Thank you (and my other guardian angels) for spending time to help me with this issue :)

  • mnotermans5114
    mnotermans5114 Community Member Posts: 916
    Although using the Translation function as suggested by Amanda works fine, i did indeed use it like that to create variations on a setup Lectora, the biggest thing to watch is your start Lectora need to be completely ready. Changes on it in a later phase make it necessary to re-export the text files, do your edits and re-import them. So it will work, but you need to adhere strictly to your basic setup Lectora.