<?php $content = new \Basecoat\View(); $content->add('hello_world', 'Hello World'); $content->processTemplate($basecoat->view->templates_path . $basecoat->routing->current['template']); $content->addToView($basecoat->view); unset($content); $basecoat->routing->runNext();
<?php $basecoat->view->add('title', '404: Not Found'); header('HTTP/1.0 404 Not Found'); $content = new \Basecoat\View(); $content->add('requested_page', $this->requested_route); // Add route content to page $content->processTemplate($basecoat->view->templates_path . $this->current['template']); $content->addToView($basecoat->view); unset($content);
// Save task if ($_POST['task_id'] == 'new') { $task_data['created_on'] = date('Y-m-d'); $result = $tasks->save($_POST['task_data']); } else { $result = $tasks->update($_POST['task_id'], $_POST['task_data']); } if ($result <= 0) { $basecoat->messages->error('Error saving task: ' . Core::$db->errorMsg); } else { $basecoat->messages->info('The task has been saved, now do it!'); header('Location: ./'); } } $content = new \Basecoat\View(); $content->add('status_opts', $tasks->getStatusOpts()); $content->add('category_opts', $tasks->getCategoryOpts()); if ($_GET['id'] != 'new') { // Retrieve task $task_data = $tasks->get($_GET['id']); if (!is_array($task_data)) { $basecoat->messages->error('Invalid Task ID specified, entering a new Task'); $_GET['task_id'] = 'new'; } } if ($_GET['id'] == 'new') { $task_data = array('task' => '', 'description' => '', 'category_id' => $tasks->default_category_id, 'status_id' => $tasks->default_status_id); } $task_data['task_id'] = $_GET['id']; $content->multiadd($task_data); // Add route content to page
<?php $content = new \Basecoat\View(); $content->add('title', '404: Not Found'); header('HTTP/1.0 404 Not Found'); $content->add('requested_page', $basecoat->routing->requested_url); // Add route content to page $content->processTemplate($basecoat->view->templates_path . $basecoat->routing->current['template']); $content->addToView($basecoat->view); unset($content);
<?php $basecoat->view->add('title', 'Routing'); $content = new \Basecoat\View(); $content->enable_data_tags = false; // Get List of Configured Routes $display_route_params = array('require_secure', 'require_login', 'data_only'); ksort($basecoat->routing->routes); $configured_routes = array(); foreach ($basecoat->routing->routes as $route => $settings) { $tmp = array('name' => $route); foreach ($display_route_params as $param) { $tmp[$param] = isset($settings[$param]) ? $settings[$param] : '-'; } $configured_routes[] = $tmp; } $content->add('routes', $configured_routes); // Add route content to page $content->processTemplate($basecoat->view->templates_path . $basecoat->routing->current['template']); $content->addToView($basecoat->view); unset($content); $basecoat->routing->runNext();
<?php $basecoat->view->add('title', '404: Not Found'); header('HTTP/1.0 404 Not Found'); $content = new \Basecoat\View(); $content->add('requested_page', $basecoat->routing->running_route); // Add route content to page $content->processTemplate($basecoat->view->templates_path . $basecoat->routing->current['template']); $content->addToView($basecoat->view); unset($content);
<?php global $tasks; $content = new \Basecoat\View(); // Check if we are adding or deleting if (isset($_POST['delete'])) { $dresult = $basecoat->db->delete('tasks', 'task LIKE :task_filter', array('task_filter' => 'Carpe Diem:%')); $bulk_message = $dresult . ' tasks deleted.'; $basecoat->messages->error($bulk_message); } else { $bulk_insert = array(); for ($i = 3; $i < 6; $i++) { $bulk_insert[] = array('task' => 'Carpe Diem: ' . date('l', strtotime('-' . $i . ' days')), 'description' => 'Seize the day! ...or is it Carp is the Fish of the Day?', 'due_date' => date('Y-m-d', strtotime('-' . $i . ' days')), 'status_id' => $tasks->default_status_id, 'category_id' => $tasks->default_category_id, 'created_on' => date('Y-m-d')); } for ($i = 3; $i < 10; $i++) { $bulk_insert[] = array('task' => 'Carpe Diem: ' . date('l', strtotime('+' . $i . ' days')), 'description' => 'Seize the day! ...or is it Carp is the Fish of the Day?', 'due_date' => date('Y-m-d', strtotime('+' . $i . ' days')), 'status_id' => $tasks->default_status_id, 'category_id' => $tasks->default_category_id, 'created_on' => date('Y-m-d')); } $iresult = $tasks->save($bulk_insert); $bulk_message = $iresult . ' tasks added.'; $content->add('bulk_insert', $bulk_insert); $basecoat->messages->info($bulk_message); } // Add route content to page $content->processTemplate($basecoat->view->templates_path . $basecoat->routing->current['template']); $content->addToView($basecoat->view); unset($content);