Well, at least you can use HTML to build the User-Interface of your program/script, using CGI (Common Gateway Interface).
It is a technique, not a programming-language.
So I will show how to use it with Puppybasic.
You could use a pure shellscript, too.
CGI needs a Webserver - Puppy has Ghttpd.
You should not start it with the defaultvalues, as it is a high security-risk: Ghttpd can access your whole root-filesystem!
Edit /root/ghttpd/httpd.cfg
Replace
SERVER_HOSTNAME = "any"
with
SERVER_HOSTNAME = "localhost"
Now install:
http://dotpups.de/files/PuppyBasic-CGI-Demo.pup (8 kb)
Now run the Webserver in a consolewindow:
/root/ghttpd/httpd
In Dillo, enter this URL (with the port you chose):
http://localhost/cgi-bin/gif-view.cgi
You should see:
You can click the links, to browse the folders:
If you click on a gif, it is displayed in a new window.
The program consists of 4 Parts:
/usr/lib/wxbasicscript/basefunctions2.inc (updated library for Puppybasic)
/root/ghttpd/cgi-bin/gif-view.cgi
This is a shell-script, that generates the HTML-header, and starts the Puppybasic-Program.
/root/ghttpd/cgi-bin/PB-gifview/mu1.pb
This is the main-"program":
Code: Select all
#!/usr/bin/puppybasic
option explicit
DIM STARTDIR
include "/usr/lib/wxbasicscript/basefunctions2.inc"
include "/root/ghttpd/cgi-bin/PB-gifview/mu1functions.inc"
Dim folder = readparameters()
print "<table border=1 bgcolor='#BBBBFF' width=100%>"
print "<tr><td colspan=2 align=center><h3>CGI Gif-Viewer</h3></td></tr>"
print "<tr><td width=50%><b>Folders:</b></td><td width=50%><b>Files:</b></td></tr>"
print "<tr><td valign=top width=50%>"
lsdirs(folder)
print "</td><td valign=top width=50%>"
lsfiles(folder)
print "</td></tr></table>"
/root/ghttpd/cgi-bin/PB-gifview/mu1functions.inc
Some helpfull stuff.
This reads directories, and generates the links.
Note, that links will get a number in the end, made of Date() and Time().
This makes shure, the Webbrowser will reload the script, and does not load it from cache.
Tip:
To see errors you make when altering the example, open a Consolewindow to monitor the Puppybasic-errors using this command:
tail -f /root/ghttpd/wx.err
Mark