NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: HPabon on January 12, 2015, 10:29:17 AM
-
Hi,
Is there a way to change on the fly, the port number assigned in the NT template?
I want to read the listening port from a file instead of assigning it in the template.
TIA
Hector
-
Hi Hector,
To read the portnumber from an inifile:
In WebServer Procedure
! Start of "NetTalk Object Before Init Section"
PortNum# = getini('KundeProg', 'Port', '88', clip(path()) & '\KundeProg.ini' )
do CheckOmittedWeb
If Net:ShortInit
s_web &= pServer
Else
s_web &= ThisWebServer
s_web.SuppressErrorMsg = 1 ! No Object Generated Error Messages ! Generated by NetTalk Extension
s_web.init()
s_web.Port = PortNum#
0{prop:text} = clip(0{prop:text}) & ' | Port:' & s_web.Port & ' |Inifil: ' & clip(GLO:Inifil) & ' | '
s_web.Open()
Get(s_web._SitesQueue,1)
End
OMIT('***HERTIL***')
And
! Start of "NetTalk Object After s_web assigned"
***HERTIL***
Cheers,
/Poul
-
Poul is close, but misses a trick.
The setting in the template is an expression, so instead of 88 or 80 you can just use a variable. Say
loc:port
Then in the embed code you just load loc:port from an ini file or xml file or whatever. Usually I put the field on a "settnigs" tab as well.
See the MultiSite Host app for an example of this.
Cheers
Bruce