<?php
include_once '../classes/TestProjektSmarty.class_subdir.php';
require_once("../config.inc.php");
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
$smarty = new SmartyAdmin();
require_once "../language/german.inc.php";
require_once("../func_get_parameter.php");
if (isset($_GET['action'])) {
  $action = $_GET['action'];
} else {
  $action = '';
}


if ($action == '') {

$anz_news = get_parameter(15);

  $query1 = "SELECT pn_id, pn_headline, pn_text, date_format(pn_date, '%d.%m.%Y - %H:%i Uhr') pn_date_form
               FROM dvm_prxnews
              ORDER BY pn_date DESC
              limit $anz_news";
  $result1 = $db->query($query1) or die("Cannot execute query1");
  
  while ($row1 = $result1->fetch_array()) {
    $table_data1[]             = $row1;
  }
  $smarty->assign('table_data1', $table_data1);

}

if ($action == 'show') {
  $pn_id = $_GET['pn_id'];
  $result_show = $db->query("SELECT pn_headline, pn_text
                               FROM dvm_prxnews
                              WHERE pn_id = $pn_id
                             ");
  $row_show    = $result_show->fetch_array();
  $smarty->assign('prx_show_headline', $row_show['pn_headline']);
  $smarty->assign('prx_show_text', $row_show['pn_text']);
}


$smarty->assign('action', "$action");
$smarty->display("$template/praxisstelle/$templatename");
?>