File "news.inc.php"

Full Path: /srv/www/www.cadoro.it/src/lib/bootstrap-sass/news.inc.php
File size: 1.23 KB
MIME-type: text/x-php
Charset: utf-8

<?php
  if ($category) {
    $category = models\BlogCategory::get_by_slug($category, 2);
  }

  $params = array(
    "year" => $year,
    "month" => $month,
    "category" => $category,
    "c_category_id" => 2,
    "published" => 1,
    "batch" => 12,
    "offset" => _request('n'),
  );

  $articles = models\BlogArticle::get($params, $params['offset'], $params['batch']);
  $params['count'] = models\BlogArticle::get_count($params);

  $query = http_build_query(array_filter(array()));
  $params['batch_url'] = BASE_URL . $request_uri . "?" . ($query ? $query . "&" : "");

  $smarty->assign("params", $params);
  $smarty->assign("articles", $articles);

  $smarty->assign("category", $category);
  $smarty->assign("year", $year);
  $smarty->assign("month", $month);

  $archive = models\BlogArticle::get_archive(2, array("published" => 1));
  $categories = models\BlogCategory::get(array("category_id" => 2, "published" => 1));

  $smarty->assign("archive", $archive);
  $smarty->assign("categories", $categories);

  $smarty->assign("menu", "news");

  if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    $smarty->display("news-ajax.tmpl");
  } else {
    $smarty->display("news.tmpl");
  }
?>