& /comps/header.msn,
no_logo_link => $p > 1 ? 0 : 1,
prev_page => (($p > 1) ? "./?p=".($p-1): undef),
next_page => (($p*$articles_per_page <= $articles_count) ? "./?p=".($p+1) : undef),
with_rss => "/rss.xml",
&>
% if ($articles and ref($articles) and scalar(@$articles)) {
% for (my ($block, $article)=(1,1); $block <= $quantity_blocks; $block++) {
% if($block == 3){
<& /comps/best_preview.msn &>
% } elsif($block == 6 || $block == 12){
<& /comps/article_teaser.msn, new_teaser => (($block == 6) ? 1 : 0) &>
% } elsif($article <= @$articles) {
<& /comps/article_preview.msn, article => $articles->[$article-1], anounce => 1 &>
% $article++;
% }
% }
% }
<& /comps/footer.msn &>
% if ($authorize) {
% }
<%ONCE>
my $quantity_blocks = 12;
my $articles_per_page = 9;
%ONCE>
<%ARGS>
$p => 1
$authorize => 0
%ARGS>
<%INIT>
my %opts = (
use_cache => 1,
proto => 'Sensator::Content::Article',
order_by => 'dtime desc',
);
$opts{status} = 1 unless $REQUEST->is_hidden();
my $articles = FrameWork::Content::Sup::get_documents(
%opts,
limit => $articles_per_page,
offset => ($p-1)*$articles_per_page
);
my $articles_count = FrameWork::Content::Sup::get_documents(%opts, count => 1);;
%INIT>