itemsPerPage; $offset = ($page - 1) * $limit; $ticks = $tickModel->getPage($limit, $offset); $view = new TicksView($config, $ticks, $page); $tickList = $view->getHtml(); $vars = [ 'config' => $config, 'user' => $user, 'tickList' => $tickList, ]; $this->render("home.php", $vars); } // POST handler // Saves the tick and reloads the homepage public function handleTick(){ if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['new_tick'])) { // save the tick if (trim($_POST['new_tick'])){ $tickModel = new TickModel(); $tickModel->insert($_POST['new_tick']); } } // get the config global $config; // redirect to the index (will show the latest tick if one was sent) header('Location: ' . $config->basePath); exit; } }