function renderLayout() { global $controller, $action, $view_layout, $config, $application_data, $view_data, $query_string, $response_type; if ($view_layout != null && $view_layout != 'none') { if ($response_type == 'html') { if (file_exists(ROOT . '/views/layouts/' . $view_layout . '.php')) { include ROOT . '/views/layouts/' . $view_layout . '.php'; } } else { //json and xml don't use layouts renderView(); } } else { //The renderView function is normally called from the layout file so we will just call it directly //since we are skipping the layout with this request. renderView(); } }
public function renderView($name, $customdata = array()) { global $theme; $viewpath = TWP___TEMPLATE_PATH . '/' . $name; if (file_exists($viewpath . '/default.php')) { include $viewpath . '/default.php'; // => $default = array() } if (!isset($default)) { $default = array(); } $data = array_merge(array(), $default, $customdata); if (!empty($_POST)) { $data['_POST'] = $_POST; } if (!empty($_SESSION)) { $data['_SESSION'] = $_SESSION; } if (!empty($_SESSION['state'])) { $data['_STATE'] = $_SESSION['state']; } if (get_current_user_id() > 0) { $data['_USER'] = $theme->getCurrentUser(); } if (file_exists($viewpath . '/index.twig')) { $html = $this->render('views/' . $name . '/index.twig', $data); } elseif (file_exists($viewpath . '.twig')) { $html = $this->render('views/' . $name . '.twig', $data); } else { renderView('404'); $html = 'No page with this URL'; } echo $html; exit; }
/** * Renderiza um template de paginacao. * * @param Braghim\Paginate $object * @param string $renderViewName */ function paginateControl(Braghim\Paginate $object, $renderViewName = 'paginacao.phtml') { // Return $items = array(); $currentPage = $object->getCurrentPage() > 0 ? $object->getCurrentPage() : 1; $totalPages = $object->getTotalPages(); $pageRange = $object->getPageRange() === 'total' ? $totalPages : $object->getPageRange(); // Page range odd if ($pageRange % 2 == 0) { $pageRange--; } if ($currentPage <= $totalPages) { $bothSides = ($pageRange - 1) / 2; // Mount beginning for ($i = 0; $i < $bothSides; $i++) { $page = $currentPage - ($bothSides - $i); if ($page <= $totalPages) { if ($page >= 1) { $items[] = $page; } } } // Half if ($currentPage <= $totalPages) { if (!in_array($currentPage, $items)) { $items[] = (int) $currentPage; } } $itemsCount = count($items); $last = end($items); $need = $pageRange - $itemsCount; // End for ($i = 0; $i < $need; $i++) { if ($last + $i + 1 <= $totalPages) { $items[] = $last + $i + 1; } } // If missed any in the beginning. if (count($items) < $pageRange) { $need = $pageRange - count($items); for ($i = 0; $i < $need; $i++) { if ($items[0] - 1 <= $totalPages && $items[0] - 1 > 0) { array_unshift($items, $items[0] - 1); } } } } else { for ($i = 0; $i < $totalPages; $i++) { $items[] = $totalPages - $i; } foreach ($items as $kI => $fI) { if ($kI > $pageRange - 1) { unset($items[$kI]); } } $items = array_reverse($items); } if (count($items) < 2) { $items = array(); } // Define a url base. $url = '/' . preg_replace("/\\?(" . preg_quote(getenv('QUERY_STRING'), "/") . ")/", "", trim(getenv('REQUEST_URI'), '/')) . "?"; foreach ((array) filter_input_array(INPUT_GET) as $i => $value) { if ($i != 'pagina') { $url .= $i . '=' . $value . '&'; } } $url = trim(trim($url, '?'), '&'); // Envia para view que monta o html da paginacao return renderView($renderViewName, array('items' => $items, 'totalPages' => $totalPages, 'currentPage' => $currentPage, 'nextPage' => in_array($currentPage + 1, $items) ? $currentPage + 1 : false, 'previousPage' => in_array($currentPage - 1, $items) ? $currentPage - 1 : false, 'baseUrl' => $url . (preg_match("/\\?/", $url) ? '&' : '?'))); }
/** * Pega conteúdo da view * Foi feito no arquivo functions.php, para ser usado mesmo pelo terminal. * * @param type $renderViewName * @param type $vars * @param type $renderViewPath * @return type */ public function renderView($renderViewName, $vars = array(), $renderViewPath = null) { if (!$renderViewPath) { $renderViewPath = self::$params->mainPath . DIRECTORY_SEPARATOR . self::$params->moduleName . '/views'; } return renderView($renderViewName, $vars, $renderViewPath); }
$p_record['type'] = CloudBankConsts::LedgerAccountType_Account; }); CloudBank::AddLinks($v_accounts, 'events.php', array('ledger_account_id' => 'id', 'ledger_account_type' => 'type'), 'name', 'account_link'); $v_template->set('accounts', $v_accounts); $p_form = preparePurgeForm($p_variables); break; case 'import': $p_form = prepareImportForm($p_variables, $v_dummy); break; } return $v_template; } function renderView($p_template, $p_form, $p_variables) { global $page_output, $notification; $page_output->header(); $notification->notify(array('listeners' => 'status')); if ($p_template) { echo $p_template->fetch(CLOUDBANK_TEMPLATES . '/accounts_for_statement.html'); } if ($p_form) { $p_form->renderActive(new Horde_Form_Renderer(), $p_variables, 'statement.php', 'post'); } $page_output->footer(); } /* main() */ $g_variables =& Horde_Variables::getDefaultVariables(); processActions($g_variables); $g_template = prepareView($g_variables, $g_form); renderView($g_template, $g_form, $g_variables);
<!DOCTYPE html> <html> <head> <title>Welcome to Pooch</title> <!-- App JS --> <?php echo jsTags(); ?> <!-- App CSS --> <?php echo cssTags(); ?> </head> <body> <?php renderView(); ?> </body> </html>
public function upload() { renderView("Index", "upload"); }
} catch (Exception $v_exception) { Cloudbank::PushError(Book::XtractMessage($v_exception)); } //print "submitted/after create/modifyEvent(): " . $p_variables->get('amount'); } else { $v_isEmpty = !$p_variables->get('date'); //print "not submitted/before PopulateEventForm():" . $p_variables->get('amount'); if ($v_isEmpty) { setDefaultValues($p_variables); } else { Book::Singleton()->PopulateEventForm($p_variables); } //print "not submitted/after PopulateEventForm():" . $p_variables->get('amount'); } return $v_isEdit; } function renderView(&$p_form, $p_variables, $p_isEdit) { global $title, $page_output, $notification; $title = $p_isEdit ? 'Edit Event' : 'Add Event'; $page_output->header(); $notification->notify(array('listeners' => 'status')); $p_form->renderActive(new Horde_Form_Renderer(), $p_variables, 'event.php', 'post'); $page_output->footer(); } /* main() */ $g_variables =& Horde_Variables::getDefaultVariables(); $g_form = prepareForm($g_variables); $g_isEdit = processActions($g_variables, $g_form); renderView($g_form, $g_variables, $g_isEdit);
<?php if (!defined('INIT')) { die; } $news = array(array('title' => 'Test', 'content' => 'Test test test'), array('title' => 'Test', 'content' => 'Test test test'), array('title' => 'Test', 'content' => 'Test test test'), array('title' => 'Test', 'content' => 'Test test test'), array('title' => 'Test', 'content' => 'Test test test')); var_dump(executeQuery("INSERT INTO accounts (`name`, `password`, `email`) VALUES ('testowy123', 'testowe123', '*****@*****.**')")); var_dump(executeQuery("SELECT id FROM accounts LIMIT 1")); var_dump(executeQuery("SELECT id FROM accounts WHERE id > ? AND id < ? LIMIT 1", 'ii', 2, 4)); //die(); return renderView('home', array('news' => $news));
function index() { renderView('index', 'index'); }
<?php if (!defined('INIT')) { die; } if (count($_POST)) { $errors = array(); //@todo if (!count($errors)) { return renderView('createaccount/success'); } return renderView('createaccount/form', array('errors' => $errors)); } return renderView('createaccount/form');
break; case 'delete': if ($_POST) { if ($_POST['submit'] == 'si') { deleteUser($_GET['id'], $config['filename']); include "../application/views/select.php"; } } else { //ob_start(); //require_once("../application/views/delete.php"); //$content=ob_get_flush(); //ob_end_clean(); $params['arrayUsers'] = $arrayUsers; $content = renderView($config, "delete", $params); } break; case 'select': //ob_start(); $arrayUsers = readUsersFromFile($config['filename']); $params['arrayUsers'] = $arrayUsers; //include("../application/views/select.php"); //$content=ob_get_flush(); //ob_end_clean(); $content = renderView($config, "select", $params); default: break; } //conbertir contenido a una cadena ppara pasar al layout //$content=ob_get_contents(); include "../application/layouts/layout_admin1.php"; //ob_end_clean();
<?php renderView("Tag", "head", $_viewData); ?> <p>m3 start</p> <div> <?php print_r($_viewData); echo "\n"; echo appF1(); echo "\n"; ?> </div> <div><a href="<?php echo UA("Index/index"); ?> "> index </a></div> <script type="text/javascript" src="<?php echo U("Public/app.js"); ?> "></script> <p>m3 end</p>