本文整理汇总了PHP中Illuminate\View\View::render方法的典型用法代码示例。如果您正苦于以下问题:PHP View::render方法的具体用法?PHP View::render怎么用?PHP View::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\View\View
的用法示例。
在下文中一共展示了View::render方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Use this in your templates to render views returned by the controllers
*
* @param \Illuminate\View\View $view The view to be rendered
*/
public static function render($view)
{
try {
echo $view->render();
} catch (\Exception $e) {
echo $e->getMessage();
}
}
示例2: handle
/**
* Publish a source file and/or pass to $next.
*
* @param Source $source
* @param Closure $next
* @param array $extensions
* @return mixed
*/
public function handle(Source $source, Closure $next, ...$extensions)
{
if ($this->isPublishable($source, $extensions)) {
$view = new View($this->factory, $this->factory->getEngineFromPath($source->getPathname()), $this->files->get($source->getPathname()), $source->getPathname());
$source->changeExtension(['.blade.php' => '.html'])->changeExtension(['.php' => '.html']);
$this->write($source->getOutputPathname(), $view->render());
}
$next($source);
}
示例3: displayFields
/**
* Render the user fields.
*
* @param \WP_User|string If adding a user, $user is the context (string): 'add-existing-user' for multisite, 'add.new-user' for single. Else is a \WP_User instance.
*/
public function displayFields($user)
{
// Add nonce fields for safety.
if (!static::$hasNonce) {
wp_nonce_field('user', '_themosisnonce');
static::$hasNonce = true;
}
// Set the value attribute for each field.
$fields = $this->setDefaultValue($user, $this->fields);
// User view data
$params = ['__factory' => $this, '__fields' => $fields, '__sections' => $this->sections, '__user' => $user, '__userContext' => null];
// Check if $user is a string context
if (is_string($user)) {
// Set to null __user
$params['__user'] = null;
// Set the context
$params['__userContext'] = $user;
}
// Pass data to user view.
$this->view->with($params);
// Render the fields.
echo $this->view->render();
}
示例4: render
/**
* Render the template.
*
* @return string
*/
public function render()
{
return $this->view->render();
}
示例5: render
/**
* Get the string contents of the view.
*
* @param callable|null $callback
* @return string
* @throws Exception
* @throws Throwable
*/
public function render(callable $callback = null)
{
$rendered = parent::render($callback);
$this->factory->getDispatcher()->fire("tempTemplateRendered", $this->getName());
return $rendered;
}
示例6: render
/**
* Renders a Blade template with passed and stored symbol data.
*
* @param string $view - view name i.e.: 'sample' resolves to [template_path]/sample.blade.php
* @param array $data
*
* @return string
*/
public function render($view, $data = [])
{
# resolve the view path based on the template paths and the view name
$view = $this->view_finder->find($view);
# collect data from the context and other places
$data = parent::collectContext($data);
# create an illuminate view from stored factory and blade engine
$blade_view = new IlluminateView($this->factory, $this->blade_engine, NULL, $view, (array) $data);
# render and return the result
return $blade_view->render();
}
示例7: view
/**
* Takes a View and returns $this to further chain methods on.
*
* @param View $view
* @return $this
*/
public function view(View $view)
{
$this->markup .= $view->render();
return $this;
}
示例8: render
/**
* Render the metabox.
*
* @param array $fields
* @param \WP_Post $post
*/
protected function render(array $fields, $post)
{
$this->view->with(['__fields' => $fields, '__metabox' => $this, '__post' => $post]);
echo $this->view->render();
}
示例9: render
/**
* @param string $view
* @param array $data
*
* @return string
*/
public function render($view = NULL, array $data = []) : string
{
// merge existing scope with provided data array
$this->merge($data);
if (NULL === $view) {
$view = $this->template;
}
// one way or the other, there must be a template to render
if (NULL === $view) {
throw new \InvalidArgumentException('No view template supplied.');
}
$path = $this->context->finder()->find($view);
$blade_view = new View($this->context->factory(), $this->context->engine(), NULL, $path, $this->context->toArray());
return $blade_view->render();
}
示例10: displayPage
/**
* Triggered by the 'add_menu_page' or 'add_submenu_page'.
*/
public function displayPage()
{
// Share the page instance to the view.
$this->with('__page', $this);
echo $this->view->render();
}