0, 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 0, 11 => 0, 12 => 0]; $now = date('Y'); $blog = RainLab\Blog\Models\Post::where('published_at', '>', 0)->get(); foreach ($blog as $item) { $year = substr($item->published_at, 0, 4); if ($year == $now) { $thisYear[(int)substr($item->published_at, 5, 2)]++; } else if ($year == $now - 1) { $lastYear[(int)substr($item->published_at, 5, 2)]++; $lastYear[0]++; } } // Posts Length $blog = RainLab\Blog\Models\Post::get(); $posts = []; foreach ($blog as $item) { $posts[$item->id] = strlen(strip_tags($item->excerpt.$item->content)); } // Longest posts arsort($posts); $longest = ''; $index = 1; foreach ($posts as $id => $length) { $item = RainLab\Blog\Models\Post::whereId($id)->first(); $longest .= '
'.$index.'.
'.$item->title.'
'.number_format($length, 0, '.', ' ').'
'; if ($index == 10) { break; } $index++; } // Shortest posts asort($posts); $shortest = ''; $index = 1; foreach ($posts as $id => $length) { $item = RainLab\Blog\Models\Post::whereId($id)->first(); $shortest .= '
'.$index.'.
'.$item->title.'
'.number_format($length, 0, '.', ' ').'
'; if ($index == 10) { break; } $index++; } ?>

0): ?>