Outputting database vars to Lectora

tekprof
Community Member Posts: 39
I have noticed that a number of us are using Lectora to create webpages that ultimately submit data to a database. With a little cgi scripting it isn't all that difficult. However, recently, I have been asked whether it is possible to go the other way, and that is take data from a database and display it in an html file created by Lectora. This would be very useful if, for example, you were querying a database and you wanted the output of your query to be nicely formatted. Since Lectora gives you that easy to use nice formatting, this seemed like a very natural question.It turns out you can take data from a database and have it displayed in an html file created by Lectora. This is how you do it:5 step process:Step 1: Create a page in Lectora and add some top of file scripting (I use ASP) to query the data and place the data in ASP variables.Step 2: In that same "book" go to variable manager and create corresponding Lectora variables and set them all to zero. (They need to be set to something so zero seems like a good choice. I wish we had subscripted variables because I use those a lot in my cgi but we don't so you will have to make do with Lectora variables that are close in name to the ASP variable names.)Step 3. Create a series of show actions on the page (with a second or two delay to allow the top of file scripting to complete...although it may complete anyway) that modify a Lectora variable's content to that of the ASP variable. When it asks what you want to change the Lectora variable to instead of putting in a string or number put in <% = q(1)%> where q(1) was the ASP variable you used at the top of file scripting.Step 4: Decide where on the page you want that result to show, create a standard textbox in Lectora and position it where you want. Put a dummy value in the textbox such as a capital X. Create an on Show action for the textbox to change the contents to the Lectora variable (you will pick it out of a picklist). You will never see the X. As soon as the texbox shows it will replace the X with the Lectora variable contents you want.Step 5: When you publish the page save it as index.asp and not index.html. Then post the page on an IIS server.And that is all there is to it.Edited By: tekprof on 2006-3-25 19:37:44
Categories
- 35.9K All Categories
- 109 ✫ Announcements
- 33.1K Lectora®
- 31.1K Lectora Discussions
- 29K Lectora Desktop
- 2K Lectora Online
- 2K Lectora Feature Requests
- 71 Lectora User Groups
- 36 Lectora Accessibility User Group (LAUG)
- 25 ELB Learning Content
- 25 ELB Learning Content Discussions
- 328 CenarioVR®
- 195 CenarioVR Discussions
- 133 CenarioVR Feature Requests
- 42 Rockstar Learning Platform®
- 39 Rockstar Learning Platform Discussions
- 108 CourseMill®
- 108 CourseMill Discussions
- 47 ReviewLink®
- 47 ReviewLink Discussions
- 7 The Training Arcade®
- 7 The Training Arcade Discussions
- 936 All Things eLearning
- 37 eLearning Development
- 546 Learning Management System (LMS) Integration
- 333 Web Accessibility
- 1.2K ♪ The Green Room
- 9 Additional Learning Products