Structure of a Web App Open on a page of its own


Here below you see an example of a standard Web Applications for DBFree:


In the example above we see a Web App with a single DBApp.
The Entrypoint of the whole application is the Home Page placed in the Web Root (i.e.c:\maxsis\dbfreev41\web\ (if you're using DBFree V41) or ::\dbw\srv\servername\web\ (if you're using DBWeb) while the only DBApp is reached by using the stock indexer page list_apps.msp (available from Code Assistant).

Portable DBApps

In this example we have only a single DBApp. In facts you can have many: there is no theoretical limit, but to keep things practical a couple of hundreds should be the largest number (this greatly depend from how to access them: the automated menu becomes very slugghish when dealing with more than 20 DBApps, while direct links are instantaneous).

DBFree standards require you any DBApp to be placed inside the APPS Root (i.e. c:\maxsis\dbfreev41\web\apps\), each one having its own folder (the App Box) and an entrypoint.

A DBApp entrypoint must be named start.msp (otherwise it won't be recognised by the indexers) and contain the appropriate header for a DBApp.The indexer page automatically detects how many boxes there are and produce a link for each of them.
Some exceptions are accepted: you can also name the entrypoint of your DBApp differently if you provide manual links to it. DBApps can be also called directly (without pasing first from the Web App entrypoint) providing you configure the application that way (i.e. include in the App Box everything is necessary). Anyway more you stay closse to standards, more you'll benefit from code already existing.

Example of DBApp entrypoint page

<!DOCTYPE html><html>
<!--
####################################################################################################
### File.....: start.msp
### Purpose..: entrypoint page
### Note.....: requires DBX-4-0-1_2016-02-16-2316
####################################################################################################
//-->
<%
xcWebId := "4017"
myAppId := "myDBApp"
********************************************* APP ENTRYPOINT HEADER V4.0.1.7
library := mspconfigvar("LIBDIR")+"\free.lib"

set maxlib to &library
web()
cSeed := iif(empty(mspfieldvalue("XY")),getSeed(),mspfieldvalue("XY"))
vSession := restoreSession(cSeed) 
if empty(vSession) or not file(vSession)
vSession := initSession(cSeed)
save all like x* to (vSession)
jreload(cSelf+"?XY="+cSeed)
return
endif
cSelf := pagename()
qq := "XY="+cSeed+"&Z="
qz := "?"+qq
my := cSelf + qz
preload("/common/header.h",cSeed,"XYZ","pagetitle","DBFree "+filebone(pagefile())) 
 
 
********************************************* 
lDebug :=.t.
cMsg :=""
xcAppId := myAppId
comment("YOUR SESSION FILE IS " + vSession )

//-- LOCAL VARIABLES
cAction  := mspfieldvalue("VA")
cIniFile := curDosDir()+"app.ini"
nUsrLev  := c2n(readIniVar(cIniFile,"xnAppLev"))
cErrMsg  := ""
********************************************* END OF ENTRYPOINT HEADER V4.0.1.7
%>
<body>
<%=container()%>
<h1>Welcome to my DBApp</h1><hr>
<%=container(0)%>
</body>
</html>
For a more detailed explanation of the structure of a Web App please see Developing Web Apps in the Publications section of this site.