<?php require_once 'config/config.conf.php'; try { $search = Recipe::Search($_GET); $vars = array('search' => $search); Model::displayTemplate('search.tpl', $vars); } catch (Exception $e) { echo $e->getMessage(); }
<?php require_once 'config/config.conf.php'; $result = null; $errors = array(); $contact = new Contact(); // On a appuyé sur le bouton Envoyer, le formulaire a été soumis if (!empty($_POST)) { foreach ($_POST as $key => $value) { try { $contact->{$key} = $value; } catch (Exception $e) { $errors[$key] = $e->getMessage(); } } if (empty($errors)) { $result = $contact->insert(); } } $vars = array('contact' => $contact, 'errors' => $errors, 'result' => $result); Model::displayTemplate('contact.tpl', $vars);
<?php require_once 'config/config.conf.php'; $recipe = Recipe::selectOne('SELECT * FROM recipe ORDER BY RAND() LIMIT 1'); if (empty($recipe)) { header('Location: index.php'); exit; } $vars = array('recipe' => $recipe); Model::displayTemplate('recipe.tpl', $vars);
<?php require_once 'config/config.conf.php'; //$random_recipes = Recipe::getList('*', '', array(), 'RAND()', 3); $random_recipes = Recipe::select('SELECT * FROM recipe ORDER BY RAND() LIMIT 3'); $vars = array('random_recipes' => $random_recipes); Model::displayTemplate('index.tpl', $vars);