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


PHP View::__construct方法代码示例

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


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

示例1: header

 function __construct()
 {
     parent::__construct();
     if (!$this->is_admin) {
         header('Location: /');
     }
 }
开发者ID:questionlin,项目名称:readcat,代码行数:7,代码来源:Vsys_config.php

示例2: __construct

 public function __construct($file, $values = array())
 {
     $file = explode('/', $file);
     $file[count($file) - 1] = '-' . $file[count($file) - 1];
     $file = implode('/', $file);
     parent::__construct($file, $values);
 }
开发者ID:jeremyboles,项目名称:dispatch-advanced-views,代码行数:7,代码来源:partial.php

示例3:

 function __construct($viewfile = NULL)
 {
     parent::__construct();
     if (!is_null($viewfile)) {
         $this->viewfile = $viewfile;
     }
 }
开发者ID:laiello,项目名称:waxphp,代码行数:7,代码来源:Layout.php

示例4: __construct

 /**
  * Constructor for ThemeView sets $this->theme.
  *
  * @param Controller $controller Controller object to be rendered.
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     if ($controller) {
         $this->theme = $controller->theme;
     }
 }
开发者ID:netun0,项目名称:cakephp-social-harvester,代码行数:12,代码来源:ThemeView.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     // Если передан id варианта, добавим его в корзину
     if ($variant_id = $this->request->get('variant', 'integer')) {
         $this->cart->add_item($variant_id, $this->request->get('amount', 'integer'));
         header('location: ' . $this->config->root_url . '/cart/');
     }
     // Удаление товара из корзины
     if ($delete_variant_id = intval($this->request->get('delete_variant'))) {
         $this->cart->delete_item($delete_variant_id);
         if (!isset($_POST['submit_order']) || $_POST['submit_order'] != 1) {
             header('location: ' . $this->config->root_url . '/cart/');
         }
     }
     // Если нажали оформить заказ
     if ($this->request->post('checkout')) {
         $order->delivery_id = $this->request->post('delivery_id', 'integer');
         $order->name = $this->request->post('name');
         //$order->email       = $this->request->post('email');
         //$order->address     = $this->request->post('address');
         $order->phone = $this->request->post('phone');
         $order->comment = $this->request->post('comment');
         // Скидка
         $order->discount = empty($this->user->discount) ? 0 : $this->user->discount;
         if (!empty($this->user->id)) {
             $order->user_id = $this->user->id;
         }
         if (empty($order->name)) {
             $this->design->assign('error', 'empty_name');
         } else {
             // Добавляем заказ в базу
             $order_id = $this->orders->add_order($order);
             $_SESSION['order_id'] = $order_id;
             // Добавляем товары к заказу
             foreach ($this->request->post('amounts') as $variant_id => $amount) {
                 $this->orders->add_purchase(array('order_id' => $order_id, 'variant_id' => intval($variant_id), 'amount' => intval($amount)));
             }
             $order = $this->orders->get_order($order_id);
             // Стоимость доставки
             $delivery = $this->delivery->get_delivery($order->delivery_id);
             if (!empty($delivery) && $delivery->free_from > $order->total_price) {
                 $this->orders->update_order($order->id, array('delivery_price' => $delivery->price, 'separate_delivery' => $delivery->separate_payment));
             }
             // Отправляем письмо пользователю
             //	$this->notify->email_order_user($order->id);
             // Отправляем письмо администратору
             $this->notify->email_order_admin($order->id);
             // Очищаем корзину (сессию)
             $this->cart->empty_cart();
             // Перенаправляем на страницу заказа
             header('Location: ' . $this->config->root_url . '/order/' . $order->url);
         }
     } elseif ($amounts = $this->request->post('amounts')) {
         foreach ($amounts as $variant_id => $amount) {
             $this->cart->update_item($variant_id, $amount);
         }
         header('location: ' . $this->config->root_url . '/cart/');
     }
 }
开发者ID:dimadmb,项目名称:100shub,代码行数:60,代码来源:CartView.php

示例6: header

 function __construct()
 {
     parent::__construct();
     if (!$this->user_id) {
         header('Location: /');
     }
 }
开发者ID:questionlin,项目名称:readcat,代码行数:7,代码来源:Vuser.php

示例7: HamlParser

 function __construct(&$controller)
 {
     parent::__construct($controller);
     $this->Haml = new HamlParser(VIEWS, TMP . 'haml');
     $this->Haml->assign_by_ref('__haml', $this->Haml);
     $this->ext = '.haml';
 }
开发者ID:squeze,项目名称:singsittiche,代码行数:7,代码来源:haml.php

示例8: __construct

 /**
  * Attempts to load a view and pre-load view data.
  *
  * @throws  Kohana_Exception  if the requested view cannot be found
  * @param   string  $name view name
  * @param   string  $page_type page type: album, photo, tags, etc
  * @param   string  $theme_name view name
  * @return  void
  */
 public function __construct($name, $page_type)
 {
     $theme_name = module::get_var("gallery", "active_site_theme");
     if (!file_exists("themes/{$theme_name}")) {
         module::set_var("gallery", "active_site_theme", "default");
         theme::load_themes();
         Kohana::log("error", "Unable to locate theme '{$theme_name}', switching to default theme.");
     }
     parent::__construct($name);
     $this->theme_name = module::get_var("gallery", "active_site_theme");
     if (user::active()->admin) {
         $this->theme_name = Input::instance()->get("theme", $this->theme_name);
     }
     $this->item = null;
     $this->tag = null;
     $this->set_global("theme", $this);
     $this->set_global("user", user::active());
     $this->set_global("page_type", $page_type);
     $this->set_global("page_title", null);
     if ($page_type == "album") {
         $this->set_global("thumb_proportion", $this->thumb_proportion());
     }
     $maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
     if ($maintenance_mode) {
         message::warning(t("This site is currently in maintenance mode"));
     }
 }
开发者ID:HelixiR,项目名称:gallery3,代码行数:36,代码来源:Theme_View.php

示例9: __construct

 /**
  * Class constructor
  *
  * @param AppController $controller
  */
 public function __construct($controller)
 {
     Sl::getInstance()->view = $this;
     parent::__construct($controller);
     $this->theme =& $controller->theme;
     $this->id =& $controller->id;
 }
开发者ID:sandulungu,项目名称:StarLight,代码行数:12,代码来源:sl.php

示例10: __construct

 public function __construct()
 {
     parent::__construct();
     global $config;
     $this->_url = $config['url'];
     $this->_siteName = $config['name'];
 }
开发者ID:AngeloDamiani,项目名称:MyBeach,代码行数:7,代码来源:VMail.class.php

示例11: __construct

 /**
  * Constructor
  *
  * @param Controller $controller
  */
 public function __construct($controller)
 {
     parent::__construct($controller);
     if (isset($controller->response) && $controller->response instanceof CakeResponse) {
         $controller->response->type('json');
     }
 }
开发者ID:ndreynolds,项目名称:arcs,代码行数:12,代码来源:JsonView.php

示例12: Smarty

 /**
  * Constructor
  *
  * @return SmartyView
  */
 function __construct(&$controller)
 {
     parent::__construct($controller);
     $this->subDir = 'smarty';
     $this->ext = '.tpl';
     $this->layoutPath = 'smarty';
     //ver. 1.2's property
     $this->smarty =& new Smarty();
     $this->smarty->plugins_dir[] = VENDORS . 'smarty' . DS . 'plugins' . DS;
     $this->smarty->compile_dir = TMP . 'smarty' . DS . 'templates_c' . DS;
     $this->smarty->cache_dir = TMP . 'smarty' . DS . 'cache' . DS;
     $this->smarty->error_reporting = 'E_ALL & ~E_NOTICE';
     if (!is_null(Configure::read('Smarty.subDir'))) {
         $this->subDir = Configure::read('Smarty.subDir');
         if (empty($this->subDir)) {
             $this->subDir = null;
         }
     }
     if (!is_null(Configure::read('Smarty.ext'))) {
         $this->ext = Configure::read('Smarty.ext');
     }
     if (!is_null(Configure::read('Smarty.layoutPath'))) {
         $this->layoutPath = Configure::read('Smarty.layoutPath');
         if (empty($this->layoutPath)) {
             $this->layoutPath = null;
         }
     }
     if (!is_null(Configure::read('Smarty.left_delimiter'))) {
         $this->left_delimiter = Configure::read('Smarty.left_delimiter');
     }
     if (!is_null(Configure::read('Smarty.right_delimiter'))) {
         $this->right_delimiter = Configure::read('Smarty.right_delimiter');
     }
 }
开发者ID:kaz29,项目名称:smartyview,代码行数:39,代码来源:smarty.php

示例13: explode

 function __construct($context)
 {
     $action_parts = explode('_', $context->getAction());
     $root = $action_parts[0];
     $this->createXml($root);
     parent::__construct($context);
 }
开发者ID:RNKushwaha022,项目名称:orange-php,代码行数:7,代码来源:xmlview.class.php

示例14: __construct

 /**
  * Constructs View from Resource, initializes XSLT processor and creates URI resolver.
  * @param Resource $resource Resource
  */
 public function __construct(Resource $resource = null)
 {
     parent::__construct($resource);
     $this->doc = new DOMDocument();
     $this->template = new DOMDocument();
     $this->proc = new XSLTProcessor();
 }
开发者ID:tejdeeps,项目名称:tejcs.com,代码行数:11,代码来源:XSLTView.class.php

示例15: __construct

 public function __construct()
 {
     parent::__construct();
     $this->template_dir = 'templates/templates/';
     $this->compile_dir = 'templates/templates_c/';
     $this->config_dir = 'templates/configs/';
     $this->cache_dir = 'templates/cache/';
 }
开发者ID:AngeloDamiani,项目名称:MyBeach,代码行数:8,代码来源:VSetup.class.php


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