當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。