Date:  05/03/2002 07:06:41 AM Msg ID:  000606
From:  John Potter Thread:  000602
Subject:  Re: Re: calling function in different direct
Thanks again FoxWeb Support Team:
 
Specfically, I solved the problem thus:
 
<%
string=Session.GetVar("roadToMecca")+"htmlHeader"
do (string)
%>
 
In htmlHeader.prg I do a response.write(string) instead of returning the string to the calling program.
 
As I see it, the problem with the "set procedure" command is that the procedure file stays open until you reboot the server or, as your documentation suggests, specifically closing it in an "exit" program. An "exit" program sounds nice but in reality who the heck is going to stick that at the bottom of every program. I don't and therefore have to wait for a server reboot to modify the procedure file. No good. I've given up on using procedure files. Comments, please.
 
Ciao,
 
John Potter
Sent by FoxWeb Support on 05/02/2002 06:12:49 PM:
This is not a FoxWeb-specific problem, but rather a VFP nuisance.  You can call procedures in another directory with the DO statement by including a full path name, but you cannot do this if you are trying to receive results from a function:
 
* Valid call:
DO c:\fooBar\htmlHeader
* The following returns an error:
MyVar = c:\fooBar\htmlHeader()
 
You can work around the problem by including all your utility functions in a single PRG file and using the SET PROCEDURE TO PrgFile command.  This will allow you to call a function without having to specify a path:
 
SET PROCEDURE TO c:\fooBar\htmlHeader.prg
MyVar = htmlHeader()
 
FoxWeb Support Team
support@foxweb.com
Sent by John Potter on 05/02/2002 07:24:50 AM:
Hello,
 
Calling a function is simple enough:
 
<%=htmlHeader()%>
 
Works like a champ. htmlHeader.prg is in the current directory.
 
Not so simple though when the function is in a different directory than the calling program. Say, the relative path to the function I want to call is '.\fooBar\'
 
 
 
<%=.\fooBar\htmlHeader()%>
 
I get the error message "Function name is missing )."
 
To make things more interesting, the relative path has to be contained in a variable. Thus, what I really want to do is something like this:
 
<%
m.path=".\fooBar\"
%>
 
<%=m.pathhtmlHeader()%>
 
or
 
<%=(m.path+"htmlHeader()")%>
 
Nothing seems to work.
 
I hope you can tell me what will work.
 
Thanks in advance.
 
John Potter