当前位置: 首页>>代码示例>>PHP>>正文


PHP static::render方法代码示例

本文整理汇总了PHP中static::render方法的典型用法代码示例。如果您正苦于以下问题:PHP static::render方法的具体用法?PHP static::render怎么用?PHP static::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在static的用法示例。


在下文中一共展示了static::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forge

 /**
  * Create a view and get its content
  *
  * @param string  Name of view
  * @param array   Data to pass to the view
  * @return \Kofradia\Viev
  */
 public static function forge($name, $data = array())
 {
     $path = PATH_APP . "/views/{$name}.php";
     $view = new static($path);
     $view->setData($data);
     return $view->render();
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:14,代码来源:View.php

示例2: create

 /**
  * Create a thumbnail
  */
 static function create($source, $options = array())
 {
     // Create thumb
     $thumb = new static();
     // Load
     $thumb->load($source);
     // Set properties
     $properties = array('type', 'quality', 'alignX', 'alignY', 'background');
     // Loop
     foreach ($properties as $property) {
         // If set
         if (isset($options[$property])) {
             // Set it
             $thumb->{$property} = $options[$property];
         }
     }
     // If there's width
     if (isset($options['width']) && ($width = $options['width'])) {
         // Set width
         $thumb->width = $width;
     }
     // If there's height
     if (isset($options['height']) && ($height = $options['height'])) {
         // Set height
         $thumb->height = $height;
     }
     // Resize
     $thumb->resize();
     // Render and return
     return $thumb->render();
 }
开发者ID:ronaldborla,项目名称:thumb,代码行数:34,代码来源:Thumb.php

示例3: renderTemplate

 /**
  * @param string $templatePath
  * @param array $data
  *
  * @return string
  */
 public static function renderTemplate(string $templatePath, array $data = []) : string
 {
     if (substr($templatePath, 0, 1) != '/') {
         $templatePath = AbstractApp::getAppRoot() . '/' . $templatePath;
     }
     $phtml = new static($templatePath);
     $phtml->addDatas($data);
     return $phtml->render();
 }
开发者ID:cawaphp,项目名称:cawa,代码行数:15,代码来源:PhtmlTemplate.php

示例4: factory

 public static function factory(RendererInterface $renderer, DataObject $object, $urlType, array $attributes = array())
 {
     $element = new static();
     $element->setView($renderer);
     $element->setObject($object);
     $element->setAttributes($attributes);
     $element->setUrlType($urlType);
     return $element->render();
 }
开发者ID:jamiehannaford,项目名称:php-opencloud-zf2,代码行数:9,代码来源:AbstractElement.php

示例5: render

 /**
  * Render a HAL document in JSON format
  *
  * @param   array  $options  Rendering options. You can currently only set json_options (json_encode options)
  *
  * @return  string  The JSON representation of the HAL document
  */
 public function render($options = array())
 {
     if (isset($options['data_key'])) {
         $this->_dataKey = $options['data_key'];
     }
     if (isset($options['json_options'])) {
         $jsonOptions = $options['json_options'];
     } else {
         $jsonOptions = 0;
     }
     $serialiseThis = new \stdClass();
     // Add links
     $collection = $this->_document->getLinks();
     $serialiseThis->_links = new \stdClass();
     foreach ($collection as $rel => $links) {
         if (!is_array($links)) {
             $serialiseThis->_links->{$rel} = $this->_getLink($links);
         } else {
             $serialiseThis->_links->{$rel} = array();
             foreach ($links as $link) {
                 array_push($serialiseThis->_links->{$rel}, $this->_getLink($link));
             }
         }
     }
     // Add embedded documents
     $collection = $this->_document->getEmbedded();
     if (!empty($collection)) {
         $serialiseThis->_embedded = new \stdClass();
         foreach ($collection as $rel => $embeddeddocs) {
             $serialiseThis->_embedded->{$rel} = array();
             if (!is_array($embeddeddocs)) {
                 $embeddeddocs = array($embeddeddocs);
             }
             foreach ($embeddeddocs as $embedded) {
                 $renderer = new static($embedded);
                 array_push($serialiseThis->_embedded->{$rel}, $renderer->render($options));
             }
         }
     }
     // Add data
     $data = $this->_document->getData();
     if (is_object($data)) {
         if ($data instanceof DataModel) {
             $data = $data->toArray();
         } else {
             $data = (array) $data;
         }
         if (!empty($data)) {
             foreach ($data as $k => $v) {
                 $serialiseThis->{$k} = $v;
             }
         }
     } elseif (is_array($data)) {
         $serialiseThis->{$this->_dataKey} = $data;
     }
     return json_encode($serialiseThis, $jsonOptions);
 }
开发者ID:akeeba,项目名称:fof,代码行数:64,代码来源:Json.php

示例6: helpers

 public static function helpers()
 {
     static::$app = app();
     $link_to = new \Twig_SimpleFunction('link_to', function ($text, $route_alias, $data = [], $attributes = []) {
         $url = urlHelper($route_alias, $data);
         if (isset($attributes)) {
             $cnt = '';
             foreach ($attributes as $key => $value) {
                 $cnt .= $value[0] . '="' . $value[1] . '" ';
             }
         }
         echo '<a href="' . $url . '" ' . $cnt . '>' . $text . '</a>';
     });
     $link_to_remote = new \Twig_SimpleFunction('link_to_remote', function ($text, $url, $attributes) {
         if (isset($attributes)) {
             $cnt = '';
             foreach ($attributes as $key => $value) {
                 $cnt .= $value[0] . '="' . $value[1] . '" ';
             }
         }
         echo '<a href="' . $url . '" ' . $cnt . '>' . $text . '</a>';
     });
     $debugBarHead = new \Twig_SimpleFunction('debugBarHead', function () {
         $app = app();
         if (!$app->isProd()) {
             static::$debugbarRender = $app->debugbar;
             $test = static::$debugbarRender;
             static::$render = $test->getJsRender();
             echo static::$render->renderHead();
         } else {
             echo '';
         }
     });
     $debugBarBody = new \Twig_SimpleFunction('debugBarBody', function () {
         $app = app();
         if (!$app->isProd()) {
             echo static::$debugbarRender->render();
         } else {
             echo '';
         }
     });
     $flash = new \Twig_SimpleFunction('flash', function () {
         echo flash()->display(null, false);
     });
     $dd = new \Twig_SimpleFunction('dd', function ($data) {
         dd($data);
     });
     return ['flash' => $flash, 'debugBarHead' => $debugBarHead, 'debugBarBody' => $debugBarBody, 'link_to' => $link_to, 'link_to_remote' => $link_to_remote, 'dd' => $dd];
 }
开发者ID:betasyntax,项目名称:framework,代码行数:49,代码来源:CoreHelpers.php

示例7: execute

 /**
  * Execute the command.
  *
  * @param Application $app The application instance
  *
  * @return mixed
  */
 public static function execute(Application $app)
 {
     static::$base = dirname(__DIR__) . '/templates/help/';
     $help = new static($app->command ?: 'help');
     $help->render();
 }
开发者ID:pugphp,项目名称:framework,代码行数:13,代码来源:Help.php

示例8: load

 /**
  * load
  *
  * @param string $file
  * @param array  $data
  *
  * @return  string
  */
 public function load($file, $data = null)
 {
     $data = $this->data->bind(new Data($data));
     $renderer = new static($this->paths, $this->config);
     return $renderer->render($file, $data);
 }
开发者ID:rokite,项目名称:windwalker,代码行数:14,代码来源:PhpRenderer.php

示例9: prepare

 /**
  * Prepare a response from the given value.
  *
  * If the value is not a response, it will be converted into a response
  * instance and the content will be cast to a string.
  *
  * @param  mixed     $response
  * @return Response
  */
 public static function prepare($response)
 {
     if (!$response instanceof Response) {
         $response = new static($response);
     }
     // We'll need to force the response to be a string before closing the session,
     // since the developer may be using the session within a view, and we can't
     // age the flash data until the view is rendered.
     //
     // Since this method is used by both the Route and Controller classes, it is
     // a convenient spot to cast the application response to a string before it
     // is returned to the main request handler.
     $response->render();
     return $response;
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:24,代码来源:response.php

示例10: renderFieldset

 /**
  * Adds a fieldset object to the table.
  *
  * @param  Fieldset $fieldset
  *
  * @since 2.0
  */
 public function renderFieldset(Fieldset $fieldset)
 {
     // Create a new renderer and render the content
     $fieldsetRenderer = new static($this->csrfProvider);
     // Generate all the content
     foreach ($fieldset as $item) {
         $fieldsetRenderer->render($item);
     }
     $content = $fieldsetRenderer->getRenderedForm();
     // Create the fieldset tag and add the content
     $tag = Html::tag('fieldset', $fieldset->getAttributes(), $content);
     // Make sure everything is added to the parent table
     $cell = new Table\Cell($tag);
     $cell->setAttributes(['colspan' => 2]);
     $this->table->addCell($cell);
     $this->table->addRow();
     return '';
 }
开发者ID:fuelphp,项目名称:fieldset,代码行数:25,代码来源:BasicRender.php

示例11: export

 /**
  * Export
  *
  * @param Di $di
  * @param array $runtimeClasses
  * @return void
  */
 public static function export(Di $di, array $runtimeClasses = array())
 {
     $console = new static($di);
     $console->addRuntimeClasses($runtimeClasses);
     $console->render($di);
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:13,代码来源:Console.php

示例12: setRender

 public static function setRender($render)
 {
     static::$render = $render;
 }
开发者ID:antistupid,项目名称:Hasty,代码行数:4,代码来源:Debugger.php

示例13: import

 public function import($in, $data = null)
 {
     $new = new static($in, $this->getOutputStream(), $this->getRouter(), $data);
     $new->render();
     return;
 }
开发者ID:sohoa,项目名称:framework,代码行数:6,代码来源:View.php

示例14: create

 /**
  * Initializes a helper with access to the template, and if needed, some
  * parameters and content,
  * validates its properties and returns its HTML representation
  * @static
  * @param Cognosys\Template $template
  * @param array $params
  * @param mixed $content Tipically, a string, an array or a Closure
  * @return string
  */
 public static function create($template, array $params = array(), $content = null)
 {
     $helper = new static($template, $params, $content);
     $helper->validate();
     return $helper->render($content);
 }
开发者ID:renatomartins,项目名称:cognosys,代码行数:16,代码来源:HelperTag.php

示例15: page

 public static function page($template, $data = array())
 {
     $tpl = new static();
     $tpl->assign('data', $data);
     echo $tpl->render($template);
 }
开发者ID:brokencube,项目名称:hodgepodge,代码行数:6,代码来源:Smarty.php


注:本文中的static::render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。