} if (method_exists($this, $method)) { $this->beginCall($originMethod, $arguments); $return = call_user_func_array([$this, $method], $arguments); $this->endCall($originMethod, $arguments); return $return; } else { throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method"); } } /** * 得到services 里面配置的子服务childService的实例. */ public function getChildService($childServiceName) { //var_dump($this->childService['xunSearch']);exit;
* @copyright Copyright (c) 2016 FecShop Software LLC * @license http://www.fecshop.com/license/ */ ?> <?php $price_info = $parentThis['price_info']; ?> <?php if(isset($price_info['special_price']['value'])): ?> <b><?= $price_info['special_price']['symbol'] ?><?= Yii::$service->helper->format->number_format($price_info['special_price']['value']) ?></b> <del><?= $price_info['price']['symbol'] ?><?= Yii::$service->helper->format->number_format($price_info['price']['value']) ?></del> <?php else: ?> <b><?= $price_info['price']['symbol'] ?><?= Yii::$service->helper->format->number_format($price_info['price']['value']) ?></b> <?php endif; ?>
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
$viewFile = $this->getViewFile($view); if (!isset($config['class']) || empty($config['class'])) { if ($parentThis) { $params['parentThis'] = $parentThis; } return Yii::$app->view->renderFile($viewFile, $params); } if (isset($config['method']) && !empty($config['method'])) { $method = $config['method']; unset($config['method']); } else { $method = $this->defaultObMethod;
throw new InvalidConfigException($config['class'].' must implete fecshop\interfaces\block\BlockCache when you use block cache .'); } } } // 查看 $config['class'] 是否在YiiRewriteMap重写中存在配置,如果存在,则替换 !isset($config['class']) || $config['class'] = Yii::mapGetClassName($config['class']); $content = $this->renderContentHtml($configKey, $config, $parentThis); return $content; } /** * find theme file by mutil theme ,if not find view file and $throwError=true, it will throw InvalidValueException.
} else { throw new InvalidValueException(" config key: '$configKey', can not find in ".'Yii::$service->page->widget->widgetConfig'.', you must config it before use it.'); } } return $this->renderContent($configKey, $config, $parentThis); } /** * @param configKey String or Array * 如果传递的是一个配置数组,内容格式如下: * [ * # class 选填
</a> <span style="float: right;text-align: justify;width: 60%;border: none;font-size: 1.35em; color: #666;"> <a external class="product_name" href="<?= $url ?>"> <?= $name ?> </a> <br/> <?= Yii::$service->page->widget->render('product/price',['price_info' => $price_info]); ?> </span> </p> <ul> <li> <?= Yii::$service->page->translate->__('Review Star') ?>
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
* 1.get exist view file from mutil theme by theme protity. * 2.get content by yii view compontent function renderFile() , */ public function render($view, $params = []) { $viewFile = Yii::$service->page->theme->getViewFile($view); $content = Yii::$app->view->renderFile($viewFile, $params, $this); return $this->renderContent($content); } /** * @param $view|string * Get current layoutFile absolute path from mutil theme dir by protity.
} public function actionLists() { $data = $this->getBlock()->getLastData($editForm); return $this->render($this->action->id, $data); } }
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
* 使用方法:Yii::$service->cms->article; * 上面的例子就是获取cms服务的子服务article。 */ new fecshop\services\Application($config); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'spu' => 'p10001', '_id' => '5db65b34bfb7ae73bd69db29', ]; $_SESSION = [ '__flash' => [], 'currency_current' => 'USD', ];