public static function index() { $rules = ["id" => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 1]]]; $data = filter_input_array(INPUT_GET, $rules); if (self::checkValues($data)) { echo ViewHelper::render("view/editor/novica-detail.php", ["novica" => NovicaDB::get($data)]); } else { echo ViewHelper::render("view/editor/novica-list.php", ["novice" => NovicaDB::getAll()]); } }
<?php require_once 'model/IgralecDB.php'; /** * Created by PhpStorm. * User: Urban * Date: 08-Feb-16 * Time: 10:55 AM */ $novice = NovicaDB::getAll(); ?> <script type="text/javascript" src="<?php echo JS_URL . "scriptNovicaList.js"; ?> "></script> <h1>Vse novice</h1> <ul id="novicaList"> <?php foreach ($novice as $novica) { ?> <li> <a href="#" name="detail" value="<?php echo $novica["id"]; ?> " > <?php echo $novica["naslov"]; ?> </a>