Browse Source

* CMTD::Helpers : sql helpers

master
Alex 'AdUser' Z 7 years ago
parent
commit
fe95d448e3
  1. 14
      lib/CMTD/Helpers.pm

14
lib/CMTD/Helpers.pm

@ -58,6 +58,20 @@ sub register {
$c->app->log->error($@); $c->app->log->error($@);
}; };
}); });
$app->helper(sid_by_name => sub {
my ($c, $site) = @_;
return $self->app->db->select('sites', 'id', {site => $site})->list;
});
$app->helper(pid_by_hash => sub {
my ($c, $sid, $hash) = @_;
return $self->app->db->select('pages', 'id', {sid => $sid, hash => $hash})->list;
});
$app->helper(comments_by_pid => sub {
my ($c, $pid) = @_;
return $self->app->db->select('comments', '*', {pid => $sid}, 'seq')->hashes;
});
} }
1; 1;

Loading…
Cancel
Save