|
Posted by Jonathan N. Little on 10/07/07 04:10
dorayme wrote:
> In article <1191685585.333485.3580@o3g2000hsb.googlegroups.com>,
> Travis Newbury <TravisNewbury@hotmail.com> wrote:
>
>> On Oct 5, 6:27 pm, dorayme <doraymeRidT...@optusnet.com.au> wrote:
>>> In article <6443e$47066d6e$40cba7be$6...@NAXS.COM>,
>>> "Jonathan N. Little" <lws4...@centralva.net> wrote:
>
>>>> Again, we keep hearing about these wonderful, accessible, low-bandwidth
>>>> flash sites but no examples... Sounds like a Unicorn hunt.
>>> I do recall someone (I think it might have been Bergamot) putting
>>> a similar and very reasonable question to old Travis a while
>>> back. Travis disappeared for a while, it was the most silent I
>>> have ever heard him be. I think he might have hurried to a
>>> holiday destination the furthest from any computer likely to have
>>> a connection to a ng.
>>>
>> Provided an example yesterday look for it in this thread.
>
> I did notice a huge hunk of impressive looking code from you soon
> after I posted. This is a "wonderful, accessible, low-bandwidth
> flash site"?
>
> Seriously, I am sure it is something; but an example of a site
> site it is not.
>
And after it parses all the images it will be smaller then an html page?
Anyway here's a little Perl CGI parser that can read simple 3 field TSV(
Tab Separated Value) file to create pages, it's real tiny too but that's
not really the point is it...
#!/usr/bin/perl -w
use strict;
use CGI qw(:standard -no_xhtml);
my $me=$ENV{'SCRIPT_NAME'};
my $datafile='picturedb.tsv';
my $pixpath='http://www.example.com/pix/';
my $recno=$ENV{'QUERY_STRING'} ;
$recno=~s/[\D]*//g;
$recno=int($recno);
my ($rec, $count)=getRec($recno,$datafile);
my @fields=split("\t",$rec);
my $img=img({-src=>"$pixpath$fields[0]-1.jpg"});
my @links;
if($recno){
$links[0]=a({-href=>"$me?0"},'|< First Image');
$links[1]=a({-href=>"$me?" . ($recno-1)},'< Previous Image');
}
if($recno < --$count){
push(@links, a({-href=>"$me?". ($recno+1)},'Next Image >'));
push(@links, a({-href=>"$me?$count"},'Last Image >|'));
}
my $linkbar=ul({-id=>"linkbar"},li([@links]));
my $headstuff=head(title($fields[1]),
Link({-rel=>'stylesheet',href=>'/styles/stylesheet.css',-type=>'text/css'}));
print
header,html($headstuff,body(h1($fields[1]),div({-id=>'pixbox'},$img,$fields[2]),$linkbar));
sub getRec{
my( $recno, $db )=@_;
open(DB, $db) || die "opening db file '$db' for reading\n$!";
my ($rec, $count, @buf);
# skip comment lines with leading '#' ';' or whitespace
@buf=grep /^[^#|;|\s]/, <DB>;
close(DB);
$count=@buf;
if($recno<$count){
$rec=$buf[$recno];
return ($rec,$count);
}
else{
return ('',$count);
}
}
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|