Ben said:
In all fairness, run basic is an application, not a web page creator.
[...]
So you see dear boy, given time, that baby grows and learns.
And BASIC did. It was very successful in the 1980s, about 20 years after
it was invented. It's now 45 years old and can hardly be described as a
baby.
But having said that, Run Basic looks quite fun and I approve of your
using it.
That said is it really the tool for webpage creation? So may other
technologies tried, true, matured and actually present on web servers!
Even generalist Perl with the CGI.pm does a really concise app. Not sure
what your db backend is but even using simple TSV (tab separated value
files)
Example states in a plain text states.tsv:
ALABAMA AL
ALASKA AK
ARIZONA AZ
ARKANSAS AR
CALIFORNIA CA
COLORADO CO
CONNECTICUT CT
....
The for each state create a tsv for cities so for Alabama AL.tsv
Abbeville 101
Alabaster 102
Albertville 103
Alexander City 105
Anniston 106
Bay Minette 107
Beatrice 108
Birmingham 109
Brownville 110
Gadsden 111
Geneva 112
Greenville 113
Guntersville 114
Headland 115
Hoover 116
Huntsville 116
....
Then the CGI with actually produces valid code is 33 lines with comments!
#!/usr/bin/perl -w
#take extra effort to make 4.01 strict
use CGI qw
standard -no_xhtml);
$CGI:
EFAULT_DTD = ['-//W3C//DTD HTML 4.01//EN',
'
http://www.w3.org/TR/html4/strict.dtd'];
use CGI:
retty;
my $cities='';
my $ss=style({-type=>'text/css'},'ul { width: 15em; height: 10em;
border: 1px solid #000; float: left; overflow: scroll; list-style: none;
margin: .5em; padding: 0; }');
my $states=ul(li(linksLinks('states','s')));
if(param('s')){
$cities=ul(li(linksLinks(param('s'),'c')));
}
if(param('c')){
# do whatever you want with city info
}
print header . start_html(-title=>'Use Perl',-head=>$ss) . $states .
$cities . end_html;
sub linksLinks{
my ($file, $qs)=@_;
open( IN, "$file.tsv")|| die "Error opening file: $file.tsv' for
reading)\n$!";
my @buf=<IN>;
close IN;
foreach(@buf){
chomp;
my ($k, $v)=split("\t", $_);
$_=a({-href=>"?$qs=$v"},$k);
}
return \@buf;
}