pCOWeb
+030220966 – rel. 1.1 – 12.12.2017
71
“
getdb
”: read a
pCOWeb
parameter from a file
Returns the value of a
pCOWeb
parameter read from a specified file.
SYNTAX
<%getdb('
Filename
', '
ParameterName
')%>
IMPORTANT: the names of the
pCOWeb
files are case sensitive.
The file is searched by default in /usr/local/root/flash/etc/sysconfig/, which contains the
pCOWeb
configuration files. To use a new file of parameters for new
applications, a path other than the default can be specified, always starting from root (“/”); nonetheless, it is recommended to save the files in the default path
so as to group all the
pCOWeb
parameter settings in the same location.
Example (Figure G.e on page 71)
The ‘commcfg’ file contains the
pCOWeb
and
pCO
communication configurations. The row that defines the baud rate is:
speed=19200
The following html page:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--tagparser="/pcotagfilt"-->
<head>
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
<title>pCOWeb Demo Page</title>
</head>
<body bgcolor='#ffffff'>
<h1 style="text-align: center">pCOWeb Demo Page</h1>
<br>
BAUD RATE = <%getdb('commcfg','speed')%><br>
</body>
</html>
will generate the result shown in Figure G.e.
Figure G.e - The “getdb” TAG: example
“
setdb
”: write a
pCOWeb
parameter to a file
Writes or modifies the value of a
pCOWeb
parameter to a specified file.
SYNTAX
?script:setdb('
Filename
', '
ParameterName
’)
The same observations as made for the getdb tag also apply here.
Example (Figure G.f on page 71)
Refer to the same ‘commcfg’ file as used for the getdb tag.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<!--tagparser="/pcotagfilt"-->
<head>
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
<title>pCOWeb Demo Page</title>
</head>
<body bgcolor='#ffffff'>
<h1 style="text-align: center">pCOWeb Demo Page</h1>
<br>
<form method="POST" action="example.html">
<input type="text" name="?script:setdb('commcfg','speed')" value="<%getdb('commcfg','speed')%>">
<input type="submit" value="Submit">
</form>
</body>
</html>
Figure G.f - The “setdb” TAG: example