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


PHP Block::factory方法代码示例

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


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

示例1: fill

 function fill()
 {
     if (!$this->filled) {
         $this->filled = true;
         if ($custom = $this->fullCustomID()) {
             $handler = Block::factory($custom);
             $func = 'menu_' . strtolower($action = Block::actionFrom($custom));
             if (method_exists($handler, $func)) {
                 $handler->{$func}($this);
             } else {
                 $this->html = $handler->execute($action, $this->argArray())->render();
             }
         }
     }
     return $this;
 }
开发者ID:SerdarSanri,项目名称:VaneMart,代码行数:16,代码来源:MenuItem.php

示例2: serve

 function serve($args = array())
 {
     if ($server = $this->findServer()) {
         // replace (:N) patterns inside controller string, e.g.: 'user@(;1)'.
         static::references($server, $args);
         // prepend arguments that can be defined in the server string after
         // a space: 'help@show contacts'.
         $server = strtok($server, ' ');
         $prepend = '' . strtok(null);
         $prepend === '' or $args = array_merge(explode(' ', $prepend), $args);
         // construct server instance (either a Block or a regular Controller).
         $this->lastArgs = $args;
         $block = $this->lastServer = Block::factory($server);
         // if server is not a traditional controller but a Vane block - set it up.
         if ($block instanceof Block) {
             $block->top = $this->lastLayout;
             $block->isServer = true;
         }
         // produce response (can be of arbitrary type).
         $this->lastArgs = $args;
         $response = $block->execute(Block::actionFrom($server), $args);
         // convert response to a Laravel\Response descendant.
         return with(new Block())->toResponse($response);
     }
 }
开发者ID:SerdarSanri,项目名称:VaneMart,代码行数:25,代码来源:Route.php

示例3: render_block

 public function render_block($block, $block_name = NULL)
 {
     $block->data = isset($block->data) ? $block->data : array();
     $block->data = !is_array($block->data) ? (array) @json_decode($block->data, TRUE) : $block->data;
     $data['_block'] = $block;
     $data['_data'] = $block->data;
     $after = View::factory('page/block/_after', $data);
     $view = Model_Page_Block_Template::view($block->page_block_template_id, $data);
     $before = View::factory('page/block/_before', $data);
     if (!$view) {
         return View::factory('page/block/_not_found', ['name' => $block_name])->render();
     }
     // helpers
     $view->helper = Block::factory($block, $block_name, $view);
     if (!isset($view->page)) {
         View::bind_global('page', $this);
     }
     return $before->render() . $view->render() . $after->render();
 }
开发者ID:huiancg,项目名称:kohana-huia-pagemanager,代码行数:19,代码来源:Page.php


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