Difference between revisions of "EXECPYSP()"

From Lianjapedia
Jump to: navigation, search
(See Also)
 
(6 intermediate revisions by 2 users not shown)
Line 9: Line 9:
  
 
==Description==
 
==Description==
The EXECJSSP() function executes the specified Python Server page (.pysp page).  The name of the pysp file is specified in <expC1> along with any required parameters.  The optional <expC2> is the name of the output file that the generated HTML will be sent to.  If no output file is specified, it will be sent to the current output.
+
The EXECPYSP() function executes the specified Python Server page (.pysp page).  The name of the pysp file is specified in <expC1> along with any required parameters.  The optional <expC2> is the name of the output file that the generated HTML will be sent to.  If no output file is specified, it will be sent to the current output.
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
execJSSP("test.jssp","test.html")
+
execPYSP("test.pysp","test.html")
 
</code>
 
</code>
  
'''test.jssp'''
+
'''test.pysp'''
  
 
<code lang="recital">
 
<code lang="recital">
<%@ Language=JavaScript %>
+
<%@ Language=Python %>
 
<html>
 
<html>
 
<body>
 
<body>
Line 33: Line 33:
 
for i in range(rs.reccount):
 
for i in range(rs.reccount):
 
   print("<tr valign='top'>")
 
   print("<tr valign='top'>")
   for i in range(rs.fields.count):
+
   for j in range(rs.fields.count):
       print("<td>"+rs.field(i).value+"</td>")
+
       print("<td>"+rs.field(j).value+"</td>")
 
   print("</tr>");
 
   print("</tr>");
 
   rs.moveNext();
 
   rs.moveNext();
Line 48: Line 48:
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:Lianja v6.1]]
 +
[[Category:Python Scripting]]

Latest revision as of 12:43, 5 March 2024

Purpose

Function to execute a pysp script

Syntax

EXECPYSP(<expC1> [, <expC2>])

See Also

DO, EXECJAVASCRIPT(), EXECPHP(), EXECPYTHON(), EXECRSP(), EXECSCRIPT(), EXECJSSP(), Python Server Pages, JavaScript Server Pages, Lianja/VFP Server Pages, SPAWN

Description

The EXECPYSP() function executes the specified Python Server page (.pysp page). The name of the pysp file is specified in <expC1> along with any required parameters. The optional <expC2> is the name of the output file that the generated HTML will be sent to. If no output file is specified, it will be sent to the current output.

Example

execPYSP("test.pysp","test.html")

test.pysp

<%@ Language=Python %>
<html>
<body>
<%
db = Lianja.openDatabase("southwind")
rs = db.openRecordSet("select * from customers")
print("<table><tr>")
for i in range(rs.fields.count):
   print("<td>"+rs.field(i).name+"</td>")
 
print("</tr>")
rs.moveFirst();
for i in range(rs.reccount):
   print("<tr valign='top'>")
   for j in range(rs.fields.count):
      print("<td>"+rs.field(j).value+"</td>")
   print("</tr>");
   rs.moveNext();
 
print("</table>")
rs.close()
db.close()
%>
</body>
</html>