Dear Rick:
Thank you for your help getting the 'web connection' up and running.
I have been going though the demos, which are insanely helpful
I know that I am jumping a head a bit but I would like 2 questions answered.
I would like to get a demo up and running quickly to show that I am making progress.
I would like do a 'SELECT' against customer.dbf but I want to have multiple customer.dbf databases. How do I do it against a customer.dbf in a different web server folder and/or the local workstation. Can a path appear in a 'SELECT' statement or is there is 'set folder' command of some kind ???
How so I turn Turn FUNCTION TestPage() ... into a Testpage.wc ?? It is fun running 'webtestmain.prg' and I realize this is mentioned in the documentation (some where), but I am extremely curious.
I understand that you do NOT like having paths, but the programming we do requires it on so many levels.
Hi Edward,
1. Paths
You can do whatever you want in the FoxPro code, but like you said it's not a good idea to hard code paths. I recommend setting up any external paths either by adding them to your path statement on startup in yourServer::OnLoad()
with set path to "\\server\drive\path" ADDITIVE
or use a configuration setting in your configuration (either server or process configuration) and add the path there. In your code you then reference either Server.oConfig.cDataPath
or Config.cCustomDataPath
to access the configured path.
In either case the path is managed in one place so you don't have to hunt it down all over the place later.
2. Scripts
Not quite sure what you're asking. Do you mean run with a class method just as a script? Or run a method and then use scripting to render?
For the former, simply remove the class method and create TestPage.wcs
or TestPage.wc
(script vs. template).
For the latter use Response.ExpandScript()
:
FUNCTION TestPage
poModel = CREATEOBJECT("EMPTY")
ADDPROPERTY(poModel,"Title","Test Page")
ADDPROPERTY(poModel,"Date",DateTime())
Response.ExpandScript()
* OR: Response.ExpandScript("~/TestPage.wcs") if you want to be explicit
ENDFUNC
Hope that helps,
+++ Rick ---