本文整理匯總了PHP中type::render方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::render方法的具體用法?PHP type::render怎麽用?PHP type::render使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::render方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: displayTemplate
/**
* Display a template
* @param string $name The Template Name
* @param mixed $data Array/Object with data to merge
*
* @return string
*/
public function displayTemplate($name, $data = array())
{
if ($this->debug) {
$data = array_merge($data, array('debug' => true));
}
return $this->twig->render($name, $data);
}
示例2: form
/**
* Generates the administration form for the widget
*
* @param array $instance The array of keys and
* values for the widget
*/
public function form($instance)
{
// Reset the names so that the form's update function works properly
foreach ($this->config->fields as $field) {
$field->name = $field->init_name;
}
// Update values
$this->form->updater->set_new_instance($instance);
$this->form->updater->update();
// Set the widget specific field names and ids
foreach ($this->config->fields as $field) {
$field->id = $this->get_field_id($field->init_name);
$field->name = $this->get_field_name($field->init_name);
}
// Print the form
$this->form->render(true);
}
示例3: prepareFields
/**
* Prepare fields for table
*
* @param type $user
* @return type
*/
public function prepareFields($user, $key)
{
switch ($key) {
case 'login':
return $user->render('list', 'avatar.small');
break;
case 'reg_date':
return df($user->reg_date, 'd M Y');
break;
case 'posts':
return '<a href="' . $user->getLink() . '/posts/" class="badge' . ($user->posts > 0 ? ' badge-info' : '') . '">' . $user->posts . '</a>';
break;
case 'comments':
return '<a href="' . $user->getLink() . '/comments/" class="badge' . ($user->comments > 0 ? ' badge-warning' : '') . '">' . $user->comments . '</a>';
break;
}
}
示例4: _render
/**
* Render the menu
* @param array $menu_items
* @param array $attributes
* @param int $level
* @return type
*/
private function _render($menu_items, $attributes, $level = null, $group = null, $currentDepth = 0)
{
if ($level !== null && $level-- <= 0) {
return;
}
$items = array();
foreach ($menu_items as $item) {
if (isset($group, $item['group']) && !in_array($group, explode(',', $item['group']))) {
continue;
}
isset($item['list_attributes']) or $item['list_attributes'] = array();
if ($this->is_active($item) || $this->has_active_children($item)) {
isset($item['list_attributes']['class']) or $item['list_attributes']['class'] = '';
$item['list_attributes']['class'] .= 'active';
}
$item['pages'] = isset($item['pages']) ? $this->_render($item['pages'], array(), $level, $group, $currentDepth + 1) : '';
$items[] = $this->renderer->render_item($this, $item);
}
$str_items = implode(PHP_EOL, $items);
return $this->renderer->render($this, $str_items, $attributes, $currentDepth);
}
示例5: renderMainLayout
/**
* Renders main layout.
*/
protected function renderMainLayout($content, $pageTitle, $dirPrefix = '', $langCode = 'en')
{
$vars = ['bookTitle' => $this->bookProps['book_title'], 'bookSubtitle' => $this->bookProps['book_subtitle'], 'keywords' => implode(',', $this->bookProps['keywords']), 'pageTitle' => $pageTitle, 'copyright' => $this->bookProps['copyright'], 'links' => $this->bookProps['links'], 'content' => $content, 'dirPrefix' => $dirPrefix, 'bookProps' => $this->bookProps, 'langCode' => $langCode];
$html = $this->phpRenderer->render("data/theme/default/layout/main.php", $vars);
return $html;
}
示例6: render
/**
* render
*
* render function displays the view.
* Question Time: What if I use desctructor to render the view?
* @return void
*/
protected function render()
{
$this->view->render();
}