本文整理汇总了PHP中view::render方法的典型用法代码示例。如果您正苦于以下问题:PHP view::render方法的具体用法?PHP view::render怎么用?PHP view::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类view
的用法示例。
在下文中一共展示了view::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadTemplate
function LoadTemplate($template, $dataArr)
{
if (file_exists(TEMPLATE . DS . $template)) {
Validate_Auth::start();
$view = new view($template);
if (!empty($dataArr)) {
$view->render($dataArr);
} else {
$tempArr = array('NO' => 'DATA');
$view->render($tempArr);
}
} else {
echo 'Error!!! el template al que deseas accesar no existe. ';
echo $template;
}
}
示例2: LoadTemplate
private function LoadTemplate($template, $dataArr)
{
$MainLogger = new Logger();
$MainLogger->OpenLogger();
$MainLogger->WriteLogger('Cargando template -> ' . $template);
if (file_exists(TEMPLATE . DS . $template)) {
$view = new view($template);
if (!empty($dataArr)) {
$view->render($dataArr);
} else {
$tempArr = array('NO' => 'DATA');
$view->render($tempArr);
}
$MainLogger->CloseLogger();
} else {
$MainLogger->WriteLogger("Error!!! Template solicitado no existe. {$template}");
$MainLogger->WriteLogger("Redireccionando a -> Error 505");
$MainLogger->CloseLogger();
}
}
示例3: set
function set($route)
{
$page = isset($_GET["page"]) ? $_GET["page"] : "index";
if (array_key_exists($page, $route)) {
$route_path = root_directory . $route[$page];
} else {
// If there is no route specified, send to 404 (no page found) page.
$route_path = root_directory . blastpad_module_path . "/blastpad_cms/master/site/404.php";
}
$view = new view();
echo $view->render($route_path);
}
示例4: render
/**
* Lädt Datei, fügt View-Element, Header & Footer zusammen und erstellt Variablen für View
* @see view
* @return void
*/
public function render()
{
if (parent::render()) {
$this->setDefaultCssFiles();
$this->setDefaultJsFiles();
$systemVersion = static::$version;
$relroot = '';
include_once \base_config::$baseDir . '/style/header.php';
foreach ($this->getViewVars() as $key => $value) {
${$key} = $value;
}
include_once $this->getViewFile();
include_once \base_config::$baseDir . '/style/footer.php';
}
}
示例5: render
/**
* Erstellt Variablen für View und lädt Datei
* @see view
* @return void
*/
public function render($isNotUtf8 = false)
{
if (parent::render()) {
foreach ($this->getViewVars() as $key => $value) {
${$key} = $value;
}
if ($this->getReturnRender()) {
ob_start();
}
include $this->getViewFile();
if ($this->getReturnRender()) {
$data = ob_get_contents();
ob_end_clean();
return $data;
}
}
}
示例6: main
function main()
{
$table = "";
$see = new view();
if (isset($_POST['submit'])) {
unset($_POST['submit']);
if (empty($_POST['info'])) {
echo $see->htmlTag("p", "It's empty!", "class='error-msg'");
} else {
$data = json_decode($_POST['info'], true);
if (is_array($data)) {
$table = $this->isAnArray($data);
}
}
}
//end if
$see->render($table);
}
示例7: route
function route()
{
$fileList = '';
// Read all files in view/pl
if ($handle = opendir(VIEW_DIR . 'pl')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != ".." && $entry != "header.tpl" && $entry != "footer.tpl" && $entry != "navbar.tpl") {
$fileList = $fileList . '/' . $entry;
}
}
closedir($handle);
}
//(Router::explodeURI($fileList));
$url = Router::getURL();
print_r($url);
$model = new model();
$model->getData();
$view = new view();
$view->setNavBar(Router::explodeURI($fileList));
$view->render($url);
}
示例8: page_not_found
public function page_not_found()
{
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
view::render('error/page_not_found');
}
示例9: addOrUpdateAutomaticMessage
public function addOrUpdateAutomaticMessage()
{
Piwik::checkUserHasSomeAdminAccess();
// Get request variables
$idSite = Common::getRequestVar('idSite', null, 'int');
$idAutoMsg = Common::getRequestVar('idAutoMsg', '', 'int');
$name = Common::getRequestVar('name', '');
$segment = Common::getRequestVar('segment', '');
$transmitter = Common::getRequestVar('transmitter', '');
$message = Common::getRequestVar('message', '');
$freq = Common::getRequestVar('frequency', '');
$freqTime = Common::getRequestVar('frequency-time', '1', 'int');
$freqScale = Common::getRequestVar('frequency-scale', 'd');
// Do some job (insert or update) in case of we have enough information
if ($idSite != '' && $name != '' && $segment != '' && $message != '' && $freq != '' && $transmitter != '') {
$frequency = "0";
if ($freq != "once") {
if ($freqScale != "d" && $freqScale != "w" && $freqScale != "m") {
$freqScale = "d";
}
$frequency = $freqTime . "|" . $freqScale;
}
if ($idAutoMsg) {
ChatAutomaticMessage::update($idAutoMsg, $idSite, $name, $segment, $message, $frequency, $transmitter);
} else {
ChatAutomaticMessage::add($idSite, $name, $segment, $message, $frequency, $transmitter);
}
return true;
}
// Display
$view = new view('@Chat/addOrUpdateAutomaticMessage.twig');
if ($idAutoMsg) {
$autoMsg = ChatAutomaticMessage::get($idAutoMsg);
$view->autoMsg = $autoMsg;
$view->mode = 'update';
if ($autoMsg['frequency'] != "" && $autoMsg['frequency'] != "0") {
list($view->freqTime, $view->freqScale) = explode('|', $autoMsg['frequency']);
}
} else {
$view->mode = 'add';
}
$view->segments = ChatSegment::getAll($idSite);
$view->idSite = $idSite;
return $view->render();
}
示例10: getCode
/**
* Renders pager widget.
*
* @return string code describing pager widget
*/
public function getCode()
{
if (!$this->isEnabled()) {
return '';
}
$size = $this->size();
$offset = $this->offset();
// compile data to use on rendering pager
$setup = array('sizeName' => $this->sizeName, 'offsetName' => $this->offsetName, 'itemCount' => $this->itemCount, 'pageOffsets' => array(), 'sizes' => config::getList('pager.size.option', array(10, 20, 50, 100)), 'size' => $size, 'offset' => $offset, 'useButtons' => $this->useButtons);
for ($i = $offset; $i > -$size; $i -= $size) {
array_unshift($setup['pageOffsets'], max(0, $i));
}
$setup['currentPage'] = count($setup['pageOffsets']) - 1;
for ($i = $offset + $size; $i < $this->itemCount; $i += $size) {
array_push($setup['pageOffsets'], min($this->itemCount - ($this->showFullFinalPage() ? $size : 1), $i));
}
// render pager using template
return view::render('widgets/pager', $setup);
}
示例11: view
<?php
//error_reporting(E_ALL & ~E_NOTICE);
error_reporting(E_ALL);
require_once "view.class.php";
require_once "user.class.php";
require_once "session.class.php";
$view = new view();
$user = new user();
$session = new session();
// ログインしていなければログインフォームに戻ります
//
if (!$user->checkLogin()) {
$view->setValue("posted_email", $session->get("posted_email"));
var_dump($_SESSION);
echo $session->get("error_message");
echo $view->render("login_form.php");
$session->clearAll();
} else {
echo $view->render("mypage.php");
}
示例12: generate_code
public function generate_code()
{
$number = $this->input->post('txt_sl');
$arr_generate = array();
if ($number > 0) {
for ($i = 0; $i < $number; $i++) {
$code = strtoupper(text::random('alnum', 12));
$this->db->where('promotion_code', $code);
$this->db->where('(type <> "2" OR isnull(type))');
$result = $this->db->get('promotion')->result_array(false);
if (!empty($result)) {
$code = $this->type_1();
$this->db->where('code', $code);
$result_2 = $this->db->get('promotion_item')->result_array(false);
if (!empty($result_2)) {
$code = $this->type_2();
if (in_array($code, $arr_generate)) {
$code = $this->check_generate_code($arr_generate);
}
} else {
if (in_array($code, $arr_generate)) {
$code = $this->check_generate_code($arr_generate);
}
}
} else {
$this->db->where('code', $code);
$result_2 = $this->db->get('promotion_item')->result_array(false);
if (!empty($result_2)) {
$code = $this->type_2();
if (in_array($code, $arr_generate)) {
$code = $this->check_generate_code($arr_generate);
}
} else {
if (in_array($code, $arr_generate)) {
$code = $this->check_generate_code($arr_generate);
}
}
}
/**
* add arr
*/
$arr_generate[] = $code;
}
}
$view = new view('admin_promotion/list_generate_code');
$view->arr_generate = $arr_generate;
$view->render(true);
die;
}
示例13: index
public function index()
{
view::render('home', array('msg' => 'I am home to pifty'));
}
示例14: view
function __construct()
{
//echo "we are in portfolio controller<br>";
$viewing = new view();
$viewing->render('portfolio');
}
示例15: display
public static function display($request)
{
//setup encoding options
if (extension_loaded('mbstring')) {
mb_internal_encoding('UTF-8');
mb_http_output('UTF-8');
mb_http_input('UTF-8');
mb_language('uni');
mb_regex_encoding('UTF-8');
ob_start('mb_output_handler');
}
$request = trim($request, '/');
$parts = explode('/', $request);
$page = 'index';
$action = 'index';
$id = null;
if (isset($parts[0]) && !empty($parts[0])) {
$page = $parts[0];
if (isset($parts[1])) {
$action = $parts[1];
if (isset($parts[2])) {
$id = $parts[2];
}
}
}
$status = 200;
//HTTP OK
if (!preg_match('#^[a-zA-Z0-9-]*$#', $page) || !preg_match('#^[a-zA-Z0-9-]*$#', $action)) {
$status = 400;
//HTTP Bad Request
}
$class = str_replace('-', '_', $page) . '_page';
$page = str_replace('-', '/', $page);
$action = str_replace('-', '_', $action);
$method = $action . '_action';
$dir = dirname($page);
$page = basename($page);
$path = static::$path . '/' . $dir . '/' . $page . '.php';
if (!file_exists($path)) {
$status = 404;
} else {
include $path;
$method = $action . '_action';
if (!class_exists($class) || !method_exists($class, $method)) {
$status = 500;
}
}
$content = '';
switch ($status) {
case 200:
ob_start();
$instance = new $class(new view($action, $page));
$result = $instance->{$method}($id);
$output = ob_get_clean();
if ($result !== null) {
//API output
header('Content-Type: application/json', true);
$content = json_encode($result);
break;
}
$view = new view($action, $page);
$view->set($instance->get_vars());
$content = $view->render();
if (static::$layout) {
static::content($content);
$view = new view(static::$layout, $page);
$content = $view->render();
}
if (!empty($output)) {
$content .= '<br><br><br><div style="border:1px dashed darkred;font-family:Arial">' . '<pre>' . '<strong style="color:darkred;font-weight:bold">Module output:</strong><br>' . $output . '</pre>' . '</div>';
}
break;
case 400:
static::show_error(400, 'Bad Request', 'The request you\'ve sent to the server is malformed');
break;
case 404:
static::show_error(404, 'Not Found', 'The page you tried to call doesn\'t exist');
break;
case 500:
static::show_error(404, 'Internal Server Error', 'The page you tried to call seems to have a technical problem');
break;
}
echo $content;
}