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


PHP View::render方法代码示例

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


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

示例1: index

 public function index($room_id)
 {
     $room = $this->Room->getRoomById($room_id);
     $this->set('room', $room);
     if (!empty($room)) {
         $last_update = time();
         $idafter = 0;
         $messages = $this->Message->getMessages($room_id);
         if (!empty($messages)) {
             $messages = array_reverse($messages);
             $idafter = $messages[count($messages) - 1]['Message']['message_id'];
         }
         // Render message list
         $view = new View($this, false);
         $view->layout = false;
         $view->set(compact('messages', $messages));
         $view->viewPath = 'Message';
         $message_list = $view->render('message_list');
         $this->set('message_list', $message_list);
         $this->set('idafter', $idafter);
         $this->set('last_update', $last_update);
         $this->set('title', $room['Room']['name']);
     } else {
         $this->set('title', 'Room not found!');
     }
 }
开发者ID:jeraldluyas,项目名称:chatsystem2,代码行数:26,代码来源:RoomController.php

示例2: envoyer

 /**
  * Methode : page envoyer le mailing
  */
 public function envoyer()
 {
     if ($_POST) {
         $texte = $this->input->post('texte');
         $format = $this->input->post('format');
         $sujet = $this->input->post('sujet');
         $format = $format == 1 ? TRUE : FALSE;
         $users = $this->user->select();
         $nbr_envois = 0;
         foreach ($users as $user) {
             if ($format) {
                 $view = new View('mailing/template');
                 $view->name = ucfirst(mb_strtolower($user->username));
                 $view->content = $texte;
                 $message = $view->render();
             } else {
                 $message = $texte;
             }
             if (email::send($user->email, Kohana::config('email.from'), $sujet, $message, $format)) {
                 $nbr_envois++;
             }
         }
         return url::redirect('mailing?msg=' . urlencode(Kohana::lang('mailing.send_valide', number_format($nbr_envois))));
     } else {
         return parent::redirect_erreur('mailing');
     }
 }
开发者ID:ezioms,项目名称:RpgEditor,代码行数:30,代码来源:mailing.php

示例3: index

 public function index($feedtype = 'rss2')
 {
     if (!Kohana::config('settings.allow_feed')) {
         throw new Kohana_404_Exception();
     }
     if ($feedtype != 'atom' and $feedtype != 'rss2') {
         throw new Kohana_404_Exception();
     }
     // How Many Items Should We Retrieve?
     $limit = (isset($_GET['l']) and !empty($_GET['l']) and (int) $_GET['l'] <= 200) ? (int) $_GET['l'] : 20;
     // Start at which page?
     $page = (isset($_GET['p']) and !empty($_GET['p']) and (int) $_GET['p'] >= 1) ? (int) $_GET['p'] : 1;
     $page_position = $page == 1 ? 0 : $page * $limit;
     // Query position
     $site_url = url::base();
     // Cache the Feed with subdomain in the cache name if mhi is set
     $subdomain = '';
     if (substr_count($_SERVER["HTTP_HOST"], '.') > 1 and Kohana::config('config.enable_mhi') == TRUE) {
         $subdomain = substr($_SERVER["HTTP_HOST"], 0, strpos($_SERVER["HTTP_HOST"], '.'));
     }
     $cache = Cache::instance();
     $feed_items = $cache->get($subdomain . '_feed_' . $limit . '_' . $page);
     if ($feed_items == NULL) {
         // Cache is Empty so Re-Cache
         $incidents = ORM::factory('incident')->where('incident_active', '1')->orderby('incident_date', 'desc')->limit($limit, $page_position)->find_all();
         $items = array();
         foreach ($incidents as $incident) {
             $categories = array();
             foreach ($incident->category as $category) {
                 $categories[] = (string) $category->category_title;
             }
             $item = array();
             $item['id'] = $incident->id;
             $item['title'] = $incident->incident_title;
             $item['link'] = $site_url . 'reports/view/' . $incident->id;
             $item['description'] = $incident->incident_description;
             $item['date'] = $incident->incident_date;
             $item['categories'] = $categories;
             if ($incident->location_id != 0 and $incident->location->longitude and $incident->location->latitude) {
                 $item['point'] = array($incident->location->latitude, $incident->location->longitude);
                 $items[] = $item;
             }
         }
         $cache->set($subdomain . '_feed_' . $limit . '_' . $page, $items, array('feed'), 3600);
         // 1 Hour
         $feed_items = $items;
     }
     $feedpath = $feedtype == 'atom' ? 'feed/atom/' : 'feed/';
     header('Content-Type: application/' . ($feedtype == 'atom' ? 'atom' : 'rss') . '+xml; charset=utf-8');
     $view = new View('feed/' . $feedtype);
     $view->feed_title = Kohana::config('settings.site_name');
     $view->site_url = $site_url;
     $view->georss = 1;
     // this adds georss namespace in the feed
     $view->feed_url = $site_url . $feedpath;
     $view->feed_date = gmdate("D, d M Y H:i:s T", time());
     $view->feed_description = Kohana::lang('ui_admin.incident_feed') . ' ' . Kohana::config('settings.site_name');
     $view->items = $feed_items;
     $view->render(TRUE);
 }
开发者ID:Dirichi,项目名称:Ushahidi_Web,代码行数:60,代码来源:feed.php

示例4: Exception

 /**
  * generate xml for a form from a table
  *
  * @param object $setup 
  * @return string
  * @author Andy Bennett
  */
 function get_form_xml($setup)
 {
     $file_name = $setup->form_name;
     $dir = DATAPATH . '/xml/forms/';
     $path = $dir . $file_name . '.xml';
     if (file_exists($path)) {
         return file_get_contents($path);
     }
     if (!isset($setup->model) || !is_object($setup->model)) {
         $config = Kohana::config('controls.controllers');
         $name = Kohana::instance()->uri->segment(1);
         if (!isset($config->{$name})) {
             throw new Exception("No controller set up");
         }
         $this->set_table($config->{$name}['table']);
     } else {
         $this->set_table($setup->model->get_table());
         $name = $setup->form_name;
     }
     $field_data = $this->db->field_data($this->table);
     // print_r($field_data);
     $view = new View('xml/form');
     $view->field_data = $field_data;
     $view->name = Kohana::instance()->uri->segment(1);
     $view->action = Kohana::instance()->uri->segment(2);
     $data = $view->render();
     if (file_exists($dir)) {
         file_put_contents($path, $data);
     }
     return $data;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:38,代码来源:steamform.php

示例5: __construct

 public function __construct($id = false)
 {
     parent::__construct();
     $this->add("products");
     $this->name = "form_slider";
     $this->enctype = "multipart/form-data";
     $this->action = URL::current();
     $this->products = ProductDB::getAdminShow();
     if (!$id) {
         $this->text("title", "Название:");
         $this->textarea("description", "Описание:");
         $this->submit("insert_slider", "Сохранить");
     } else {
         $this->add("img");
         $this->add("product_id");
         $this->hidden("id", $id);
         $obj = new SliderDB();
         $obj->load($id);
         $this->text("title", "Название:", $obj->title);
         $img = ProductDB::getCellOnID($obj->product_id, "img");
         $view = new View(Config::DIR_TMPL);
         $this->img = $view->render("img", array("src" => Config::DIR_IMG_PRODUCT . $img), true);
         $this->textarea("description", "Описание:", $obj->description);
         $this->submit("update_slider", "Сохранить");
         $this->product_id = $obj->product_id;
     }
 }
开发者ID:kuaa59,项目名称:www,代码行数:27,代码来源:formslider_class.php

示例6: array

    function __construct($path)
    {
        $chanbar = '				<ul>
						<li id="settings" class="option"><a href="#" class="button">settings</a></li>
						<li id="files" class="option"><a href="#" class="button">files</a></li>
						<li id="people" class="option"><a href="#" class="button">people</a></li>
						</ul>
						';
        $user = Auth::user();
        $curchan = DB::get()->val('SELECT name from channels where user_id = :user_id AND active = 1', array('user_id' => $user->id));
        if ($curchan == '') {
            $curchan = 'bar';
        }
        $widgets = Widgets::get_widgets();
        $components = array('title' => 'Barchat Home', 'path' => $path, 'chanbar' => $chanbar, 'user_id' => Auth::user_id(), 'username' => $user->username, 'nickname' => $user->nickname, 'session_key' => $user->session_key, 'cur_chan' => addslashes($curchan), 'widgets' => $widgets);
        $v = new View($components);
        Plugin::call('reload', $user);
        //check for user agent
        $useragent = $_SERVER['HTTP_USER_AGENT'];
        //
        if (preg_match('/ip(hone|od|ad)/i', $useragent)) {
            $v->render('template-ios');
        } else {
            $v->render('template');
        }
    }
开发者ID:amitchouhan004,项目名称:barchat,代码行数:26,代码来源:index.php

示例7: create

 /**
  * Generates a model for a given schema
  * 
  * @usage ./metal model/create --database=default --schema=public --table=user --related
  * @switch database The name of the database in the conf file
  * @switch schema The name of the schema, default is 'public'
  * @switch table The name of the table to generate the model for
  * @switch related Boolean determines if any related models should be generated.
  */
 public function create()
 {
     $db = Database::Get($this->request->input->database);
     $schemaName = $this->request->input->schema ? $this->request->input->schema : 'public';
     $schema = $db->table($schemaName, $this->request->input->table, $this->request->input->related);
     $rel_classname = '';
     $names = explode('_', $this->request->input->table);
     foreach ($names as $n) {
         $rel_classname .= ucfirst($n);
     }
     $view = new View('index.html', $this, PATH_SYS . 'shell/view/model/');
     $model = $view->render(array('classname' => $rel_classname, 'schema' => $schema, 'database' => $this->request->input->database));
     $path = PATH_APP . 'model/' . $schemaName;
     if (!file_exists($path)) {
         mkdir($path);
     }
     file_put_contents($path . '/' . $schema->tablename . EXT, $model);
     foreach ($schema->related as $table) {
         $rel_classname = '';
         $names = explode('_', $table->tablename);
         foreach ($names as $n) {
             $rel_classname .= ucfirst($n);
         }
         $model = $view->render(array('classname' => $rel_classname, 'schema' => $table, 'database' => $this->request->input->database));
         $path = PATH_APP . 'model/' . $table->schema;
         if (!file_exists($path)) {
             mkdir($path);
         }
         file_put_contents($path . '/' . $table->tablename . EXT, $model);
     }
     die;
 }
开发者ID:nikels,项目名称:HeavyMetal,代码行数:41,代码来源:index.php

示例8: after

 /**
  * This method gets called after the action is called.
  *
  * @param mixed $response Value returned from the action method.
  * 
  * @return Response $response
  */
 public function after($response)
 {
     // Return if passed a response.
     if ($response instanceof Response) {
         return parent::after($response);
     }
     if ($this->autorender) {
         try {
             $this->view->set_filename(Str::lower(str_replace('_', '/', Inflector::denamespace(str_replace('controller_', '', Str::lower($this->request->controller)))) . DS . str_replace('_', '/', $this->request->action)));
         } catch (FuelException $e) {
         }
     }
     // Inject view into the layout if the main request.
     if ($this->layout instanceof View) {
         if ($this->autorender) {
             try {
                 // Throws exception if there is no view template found.
                 $this->layout->content = $this->view->render();
             } catch (FuelException $e) {
             }
         }
         $this->layout->content_data = $this->view->get();
         $this->response->body($this->layout);
     } else {
         $this->response->body($this->view);
     }
     return parent::after($this->response);
 }
开发者ID:mehulsbhatt,项目名称:volcano,代码行数:35,代码来源:controller.php

示例9: after

 /**
  * Assigns the template [View] as the request response.
  */
 public function after()
 {
     if ($this->auto_render === TRUE) {
         $this->response->body($this->template->render());
     }
     parent::after();
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:10,代码来源:template.php

示例10: testRenderLayout

 public function testRenderLayout()
 {
     $this->view->setLayout('layout');
     $output = $this->view->render('page', true);
     $this->assertContains('Page text', $output);
     $this->assertContains('Layout start', $output);
     $this->assertContains('Layout end', $output);
 }
开发者ID:starweb,项目名称:starlit-app,代码行数:8,代码来源:ViewTest.php

示例11: render

 public static function render($print = false)
 {
     Benchmark::start(self::$benchmark_name);
     $template = new View('toolbar');
     if (Kohana::config('debug_toolbar.panels.database')) {
         $template->set('queries', self::queries());
     }
     if (Kohana::config('debug_toolbar.panels.logs')) {
         $template->set('logs', self::logs());
     }
     if (Kohana::config('debug_toolbar.panels.vars_and_config')) {
         $template->set('configs', self::configs());
     }
     if (Kohana::config('debug_toolbar.panels.files')) {
         $template->set('files', self::files());
     }
     if (Kohana::config('debug_toolbar.firephp_enabled')) {
         self::firephp();
     }
     switch (Kohana::config('debug_toolbar.align')) {
         case 'right':
         case 'center':
         case 'left':
             $template->set('align', Kohana::config('debug_toolbar.align'));
             break;
         default:
             $template->set('align', 'left');
     }
     $template->set('scripts', file_get_contents(Kohana::find_file('views', 'toolbar', true, 'js')));
     Benchmark::stop(self::$benchmark_name);
     if (Kohana::config('debug_toolbar.panels.benchmarks')) {
         $template->set('benchmarks', self::benchmarks());
     }
     if (Event::$data) {
         if (Kohana::config('debug_toolbar.auto_render') or Kohana::config('debug_toolbar.secret_key') !== FALSE and isset($_GET[Kohana::config('debug_toolbar.secret_key')])) {
             // try to add css to <head>, otherwise, send to template
             $styles = file_get_contents(Kohana::find_file('views', 'toolbar', false, 'css'));
             if (stripos(Event::$data, '</head>') !== FALSE) {
                 Event::$data = str_ireplace('</head>', $styles . '</head>', Event::$data);
             } else {
                 $template->set('styles', $styles);
             }
             // try to add js and HTML just before the </body> tag,
             // otherwise just append it to the output
             if (stripos(Event::$data, '</body>') !== FALSE) {
                 Event::$data = str_ireplace('</body>', $template->render() . '</body>', Event::$data);
             } else {
                 Event::$data .= $template->render();
             }
         }
     } else {
         if ($print) {
             $template->render(TRUE);
         } else {
             return $template->render();
         }
     }
 }
开发者ID:bicho44,项目名称:imglistados,代码行数:58,代码来源:DebugToolbar.php

示例12: after

 /**
  * Assigns the template [View] as the request response.
  */
 public function after()
 {
     //send request headers
     parent::after();
     if ($this->auto_render === TRUE) {
         $this->template->content = $this->view;
         $this->response->body($this->template->render());
     }
 }
开发者ID:piotrtheis,项目名称:ko3,代码行数:12,代码来源:Core.php

示例13: indexAction

 public function indexAction()
 {
     $container = new Container();
     $collectorLocator = new CollectorLocator(new Request());
     $topCatCollector = $collectorLocator->createBannersCollector();
     $topCatCollector->collectTo($container);
     $this->assignContainerToView($container);
     echo $this->view->render();
 }
开发者ID:breathbath,项目名称:hr-project,代码行数:9,代码来源:IndexController.php

示例14: render

 public function render($action = null)
 {
     static $is_rendered = false;
     if ($is_rendered) {
         return;
     }
     $this->beforeRender();
     $this->view->render($action);
     $is_rendered = true;
 }
开发者ID:YoshinoriKato,项目名称:dietcake,代码行数:10,代码来源:controller.php

示例15: setTemplate

 function setTemplate($name, $data = array())
 {
     if ($this->subject === '') {
         throw new Exception('You must define the subject before using a template');
     }
     require_once APPPATH . 'models/objects/view.php';
     $this->setHTMLOn();
     $view = new View();
     $layout_data = array('content' => $view->render(APPPATH . 'views/emails/' . $name . '.php', $data), 'subject' => $this->subject);
     $this->body = $view->render(APPPATH . 'views/layouts/email.php', $layout_data);
 }
开发者ID:xtrimsky,项目名称:readbo,代码行数:11,代码来源:email.php


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