File "cerca.inc.php"

Full Path: /srv/www/www.cadoro.it/src/controllers/cerca.inc.php
File size: 896 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
  $items = array();

  $pages = models\Page::get(array("q" => _request('q'), "published" => 1), 0, 100);
  $articles = models\BlogArticle::get(array("q" => _request('q'), "published" => 1), 0, 100);

  foreach ($articles as $article) {
    $c = $article->get_category();
    $items[] = array(
      "title" => strip_tags($article['title']),
      "description" => strip_tags($article['description']),
      "url" => "/magazine/" . $c['slug'] . "/" . $article['slug'] . "-" . $article['id'],
    );
  }

  foreach ($pages as $page) {
    $items[] = array(
      "title" => $page['seo_title'] ? $page['seo_title'] : ($page['title'] ? strip_tags($page['title']) : $page['slug']),
      "description" => strip_tags($page['seo_description']),
      "url" => $page['slug'],
    );
  }

  $smarty->assign("pages", $pages);
  $smarty->assign("items", $items);

  $smarty->display("cerca.tmpl");
?>