本文整理汇总了PHP中self::render方法的典型用法代码示例。如果您正苦于以下问题:PHP self::render方法的具体用法?PHP self::render怎么用?PHP self::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generates a printer friendly version of a page
*
* @param string $content The HTML content of the page
* @param string $title The title of the page
* @param string $description The description of the page
* @param string $pagetitle
* @param int $width The width of the page, in pixels
*/
public static function generate($content, $title = FALSE, $description = FALSE, $pagetitle = FALSE, $width = 680)
{
$PrintDataBuilder = new self($content, $title, $description);
$PrintDataBuilder->setPageTitle($pagetitle);
$PrintDataBuilder->setWidth($width);
$PrintDataBuilder->render();
}
示例2: includeTemplate
/**
*
* @param unknown_type $template
* @param unknown_type $data
* @return string
*/
protected function includeTemplate($template, $data = null)
{
$view = new self();
$view->setTemplate($template);
$view->copyAll($data);
return $view->render();
}
示例3: process
/**
* Process partial render
*/
public static function process($nodeList, $template)
{
$renderer = new self();
// @todo: use getInstance() ?
$renderer->addNodes($nodeList);
$renderer->setTemplate($template);
return $renderer->render();
}
示例4: wrap
/**
* Wrap the content of the current template with the given template file.
*
* Esentially, this is clearing the output buffer and refilling it with a wrapped
* version of what was previously in the output buffer.
*
* @param string $file_name
* @param array $data
*
* @return void
*/
protected function wrap($file_name, array $data = array())
{
$data['wrapped_content'] = ob_get_contents();
ob_end_clean();
ob_start();
$wrapper = new self();
echo $wrapper->render($file_name, $data);
}
示例5: metabox_callback
public static function metabox_callback($post)
{
$listing = WPBDP_Listing::get($post->ID);
if (!$listing) {
return '';
}
$instance = new self($listing);
return $instance->render();
}
示例6: renderFromHtml
/**
* Helper function to render a string of HTML direct to BB code.
*
* @param string $html
* @param array $options
*
* @return string BB code
*/
public static function renderFromHtml($html, array $options = array())
{
//echo '<pre>' . htmlspecialchars($html) . '</pre>'; exit;
$parser = new XenForo_Html_Parser($html);
$renderer = new self($options);
$parsed = $parser->parse();
//$parser->printTags($parsed);
$rendered = $renderer->render($parsed);
//echo '<pre>' . htmlspecialchars($rendered) . '</pre>'; exit;
return self::filterBbCode($rendered);
}
示例7: partial
public function partial($sViewScript, $mBind = null)
{
$partial = new self();
if (null === $mBind) {
$mBind = get_object_vars($this);
}
foreach ($mBind as $key => $val) {
$partial->{$key} = $val;
}
$partial->setView($sViewScript);
return $partial->render();
}
示例8: display
public static function display($templateFile = "")
{
$view = new self();
$view->templateFile = !empty($templateFile) ? $templateFile : $view->templateFile;
$myfile_content = file_get_contents($view->viewFile);
$myfile_content = $view->tag_replace($myfile_content);
$view->create_template($view->templateFile_c, $myfile_content);
$content = $view->fetch($view->templateFile_c . ".php");
$view->create_template($view->templateFile, $content);
// 输出模板内容
$view->render($content);
}
示例9: show
public static function show($msg, $type = 'INFO')
{
$cli = new self(array('boot'));
$cli->render($msg, $type);
}
示例10: build
/**
* Static function allows to quickly generarte tag
*
* @param type $tag
* @param type $attr
* @param type $html
* @return type
*/
public static function build($tag, $attr = array(), $html = null)
{
$helper = new self($tag, $attr, $html);
return $helper->render();
}
示例11: send
/**
* Send the stylesheet to the client
*
* Does not cache the stylesheet if the HTTP header Cache-Control or Pragma is set to no-cache.
*
* @param bool $minified Whether to compress the stylesheet
*/
public static function send($minified = false)
{
$styleSheet = new self();
$request = $styleSheet->app->getRequest();
$response = $styleSheet->app->getResponse();
$noCache = $request->getHeader('Cache-Control') === 'no-cache' || $request->getHeader('Pragma') === 'no-cache';
if (!$noCache && FileCache::etagMatchesFiles($styleSheet->lessCompiler->getLessFiles())) {
$response->setHttpResponseCode(304)->sendHeaders();
return;
}
$etag = FileCache::etagForFiles($styleSheet->lessCompiler->getLessFiles());
$response->setHeader('Cache-Control', 'public', true)->setHeader('ETag', $etag, true)->setHeader('Content-Type', 'text/css', true);
$cacheFile = 'icinga-' . $etag . ($minified ? '.min' : '') . '.css';
$cache = FileCache::instance();
if (!$noCache && $cache->has($cacheFile)) {
$response->setBody($cache->get($cacheFile));
} else {
$css = $styleSheet->render($minified);
$response->setBody($css);
$cache->store($cacheFile, $css);
}
$response->sendResponse();
}
示例12: partialLoop
/**
* Given a template name, and a list of variable arrays, this method will
* iterate through all the sets of variables, rendering the template with
* each set, and concatenating them together. Could be used for looping
* through a complex list, where each list element would be too much HTML
* to cleanly place in the main template itself.
*
* @param string $template Path to template file.
* @param array $varArray Array of associative arrays containing
* template variables.
* @return string All rendered templates concatenated together.
*/
public function partialLoop($template, array $varArray = array())
{
$t = new self($template);
$s = '';
foreach ($varArray as $index => $vars) {
$t->clear();
$t->set($vars);
$t->set('loopIndex', $index);
$s .= $t->render();
}
return $s;
}
示例13: renderStatic
/**
* Returns Data Source Name String.
* @access public
* @static
* @param string $driver Database Driver (cubrid|dblib|firebird|informix|mysql|mssql|oci|odbc|pgsql|sqlite|sybase)
* @param string $database Database Name
* @param string $host Host Name or URI
* @param int $port Host Port
* @param string $username Username
* @param string $password Password
* @return string
*/
public static function renderStatic($driver, $database, $host = NULL, $port = NULL, $username = NULL, $password = NULL)
{
$dsn = new self($driver, $database);
$dsn->setHost($host);
$dsn->setPort($port);
$dsn->setUsername($username);
$dsn->setPassword($password);
return $dsn->render();
}
示例14: renderPartial
/**
* Render the requested partial.
*
* @access protected
* @param string $tag_name
* @param array $context
* @return string
*/
protected function renderPartial($tag_name, &$context)
{
$view = new self($this->getPartial($tag_name), $context, $this->partials);
$view->otag = $this->otag;
$view->ctag = $this->ctag;
return $view->render();
}
示例15: simpleRender
/**
* 快速render
*
* @return
* @param string $template_file_or_string
* @param array $context
* @param boolean $cache
* @param boolean $output
*/
public static function simpleRender($template_file_or_string, $context, $cache = false, $output = true)
{
$result = null;
if ($cache) {
$cache_name = self::getCacheName($template_file_or_string, 'html');
if (file_exists($cache_name)) {
$result = file_get_contents($cache_name);
if (!$result) {
$result = null;
}
}
}
if (null === $result) {
$t = new self($template_file_or_string);
$result = $t->render($context);
if ($cache) {
file_put_contents($cache_name, $result);
}
}
if ($output) {
echo $result;
} else {
return $result;
}
}