Revision 296 (by ahitrov, 2013/03/26 17:59:01) Promosite (anthill) project source
<div style="width: 80%">
<div style="padding:0px 0px 20px 70px;">
<h2><% $id ? 'Все новости' : 'Новости' %></h2>

% foreach my $doc (@news) {


% if ($id && $id == $doc->id) {
<div class="txt" style="padding-bottom: 15px;"><b><% $doc->name %></b></div>
% }else{
<div class="txt" style="padding-bottom: 15px;"><a href="news.html?id=<% $doc->id %>"><% $doc->name %></a></div>
% }
% }


% if ($total > $n) {
<div align="center" class="pgs">Страница <& /inc/pages_.msn,
        total => $total, n => $n, p => $p  &></div>
% }

</div></div>


<%args>

	$n	=> 20
	$p	=> 1
	$id	=> undef

</%args>
<%init>

  my $prj = $request->{project};
  my $profile = $request->{project_profile};
  my $root = $request->{project_section};
  my ($section) = $keeper->get_sections (
                s       => $root->id,
                class   => 'promosuite::NewsSection',
                status  => 1,
                limit   => 1,
        );
  return        unless  ref $section;
  my $total = $keeper->get_documents (
		s	=> $section->id,
#		class	=> 'promosuite::Article',
		class   => 'promosuite::News',
		status	=> [1,2],
		count	=> 1,
	);
  my @news = $keeper->get_documents (
		s	=> $section->id,
#		class	=> 'promosuite::Article',
		class   => 'promosuite::News',
		status	=> [1,2],
		limit	=> $n,
		offset	=> $n*($p-1),
		order	=> [qw|date direct|],
		light	=> 1,
	);
  return	unless @news;

</%init>