<%args> $c => 'item_description' <%shared> my %IARGS; my $current_cat; my $database ='chaliceart'; my $database_login = 'chaliceart'; my $database_pass = 'greendog11'; my $dbh; <%init> %IARGS = %ARGS; use Data::Dumper; $dbh = DBI->connect("DBI:mysql:$database", $database_login, $database_pass) || $m->comp("error_noreturn", message => "Database name,
login, or password is incorrect."); #$current_cat = $dbh->selectrow_array("Select category_id from Classified_connect where ad_id = ?",undef,$m->request_args->{id}); $current_cat = $m->request_args->{current_cat}; <& $c&> <%def item_description> <%init> my $data = $dbh->selectrow_hashref("Select * from Classified_ad where ad_enabled=1 AND ad_id = ?",undef,$m->request_args->{id}); #print "
";
#print Dumper($m->session);
#$m->flush_buffer;
#$m->abort;

my $arrows = $dbh->prepare("Select * from Classified_ad,Classified_connect WHERE Classified_ad.ad_id = Classified_connect.ad_id AND category_id = $current_cat AND ad_enabled=1 ORDER BY ad_title");
$arrows->execute;
my $tempcristi;
my $leftarrow=0;
my $rightarrow=0;
my $found=0; my $r=0; my $first=0; my $last=0;
while ($tempcristi = $arrows->fetchrow_hashref) {
if($tempcristi->{ad_id} eq $m->request_args->{id}){ $found=1; }
if($first eq 0) {$first = $tempcristi->{ad_id};}
if($found eq 1) {
  if($r eq 0) {
    if($tempcristi = $arrows->fetchrow_hashref) {
     $rightarrow = $tempcristi->{ad_id};
     $r=1;
     }
    }
  }
else {
 if($r eq 0) {$leftarrow = $tempcristi->{ad_id};}
 }
$last = $tempcristi->{ad_id};
}


$arrows->finish;

if($leftarrow eq 0) {$leftarrow = $last;}
if($rightarrow eq 0) {$rightarrow = $first;}

my $left = $dbh->selectrow_hashref("Select * from Classified_ad where ad_id = $leftarrow");
my $right = $dbh->selectrow_hashref("Select * from Classified_ad where ad_id = $rightarrow");



      


{ad_id}%>¤t_cat=<%$current_cat%>><< <%$left->{ad_title}%>                                                     {ad_id}%>¤t_cat=<%$current_cat%>><%$right->{ad_title}%> >>

<%$data->{ad_title}%>


% my $temp = $data->{ad_description}; % $temp =~ s/\n/
/; <%$temp%>


<%perl> # # Time to get the optios into an array of arrays my $options = $data->{ad_sku_colors}; # # Headers have no pipes '|' in them, so if there is a pipe, then its an item. my @option_lines = split(/\n/,$options); my @code; my $current_header; foreach my $line (@option_lines) { #print $line."
"; if ($line !~ /\|/g) { push(@code,{'type' => 'header', 'name' => $line}); $current_header = $line; next; } # # must be an item my @bits; foreach my $bita ( split(/\|/,$line)) { my ($bitb) = ($bita =~ /^\s*(.+)\s*$/); push (@bits,$bitb); } push (@code,{'type' => 'item', 'title' => $bits[0], 'extra' => $bits[1], 'price' => $bits[2], 'sql' => $data, 'header' => $current_header, 'has_comment' => $bits[3]}); } use Data::Dumper; #print "
";
#print Dumper(\@code);
#$m->flush_buffer;
#$m->abort;


% foreach my $row (@code) {
 <& $row->{type}, data => $row &>
% }



<%$data->{ad_title}%>

<%$data->{ad_short_description}%>

If you have questions
or
if you prefer to order by phone, call us at (903)786-8646

Order with MC, Visa, Am Ex
or mail your order with payment to us at

ChaliceArt
49 Nottingham Drive
Pottsboro, Texas 75076

e-mail chaliceart@yahoo.com

%if($IARGS{'current_cat'}){ <&productlist.htm, c=> 'get_header', cat => $IARGS{'current_cat'}&> %}else{ limited edition %}

<%def header> <%doc>   <%$ARGS{data}->{name}%>   <%def item> <%init> my @classic = ( 'Sapphire', 'Garnet', 'Amethyst' ); my @smclassic= ( 'Sapphire', 'Ruby', 'Amethyst' ); my @classear= ( 'Sapphire', 'Garnet', 'Amethyst' ); my $extra = $ARGS{data}->{extra}; my $options = $extra; my @options; my $default; if($ARGS{data}->{has_comment} == 2){ ($options) = ($options =~ /.*\[(.*)\]/); @options = split(/,/,$options); $extra =~ s/\[.*?\]//; $default = $extra; ($default) = ($default =~ /.*~(.*)~/); $extra =~ s/~$default~//; #print "
";
#print Dumper(\%options,$extra,$options);
#$m->flush_buffer;
}
#for(my $i=0;$i <= $#options;$i = $i+2){
#print $options[$i]."  ".$options[$i + 1]."
"; #} #print "<------------------------------- Option ---------------------------->
"; #print "
";
#print Dumper($m->request_args->{'id'});
#$m->flush_buffer;
#$m->abort;
my $comment;


<%$ARGS{data}->{title}%><%$extra%> % if ($ARGS{data}->{has_comment} == 1) { % }elsif($ARGS{data}->{has_comment} == 2){
Choose Length
% }else{ % } %if ($m->request_args->{'id'} eq '4'){
Choose Stone
%# % foreach(@smclassic){ % } %} %if ($m->request_args->{'id'} eq '44'){
Choose Stone
%}
$<%$ARGS{data}->{price}%>