<& blognav.mas, storyId => "", page => "Coffee Blog" &>
<% $copy %>
% if ($page >= 2) {
% }
% if ($counter == 12) {
% }
<%init>
my ($sql, $sth);
my $dbh = $m->comp('/dbconnect.mas');
my $copy;
my $image;
my $counter;
my $start = 0;
my $page = $ARGS{page};
$page =~ s/\D//g;
$page = substr($page, 0, 2);
if ($page){$start = ($page - 1) * 12} else {$page = 1}
$start =~ s/\D//g;
$start = substr($start, 0, 4);
$sql = qq|
SELECT
ID,
ID_NICE,
DATE_FORMAT(DATE_CREATED, '%M %d, %Y'),
HEADER,
TEASER
FROM
blog_lardera
WHERE
DATE_CREATED <= NOW() AND
STATUS = 1
ORDER BY
DATE_CREATED DESC
LIMIT
$start, 12
|;
$sth = $dbh->prepare($sql);
$sth->execute();
while (my ($id, $idNice, $dateCreated, $header, $teaser) = $sth->fetchrow_array()) {
# if ($id >= 9) {
# $image = $id . "-1";
# } else {
$image = $id;
# }
if (length($idNice)>0){
$copy .= qq~