Changeset 2492

Show
Ignore:
Timestamp:
04/15/2008 12:57:12 AM (6 months ago)
Author:
Shadowhand
Message:

Fixing #513, thanks memon.

Location:
trunk/system
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/i18n/en_US/core.php

    r2249 r2492  
    33$lang = array 
    44( 
    5         'there_can_be_only_one' => 'There can be only one instance of Kohana per page request.', 
     5        'there_can_be_only_one' => 'There can be only one instance of Kohana per page request', 
    66        'uncaught_exception'    => 'Uncaught %s: %s in file %s on line %s', 
    7         'invalid_method'        => 'Invalid method <tt>%s</tt> called in <tt>%s</tt>.', 
    8         'cannot_write_log'      => 'Your log.directory config setting does not point to a writable directory.', 
    9         'resource_not_found'    => 'The requested %s, <tt>%s</tt>, could not be found.', 
    10         'invalid_filetype'      => 'The requested filetype, <tt>.%s</tt>, is not allowed in your view configuration file.', 
    11         'no_default_route'      => 'Please set a default route in <tt>config/routes.php</tt>.', 
     7        'invalid_method'        => 'Invalid method <tt>%s</tt> called in <tt>%s</tt>', 
     8        'cannot_write_log'      => 'Your log.directory config setting does not point to a writable directory', 
     9        'resource_not_found'    => 'The requested %s, <tt>%s</tt>, could not be found', 
     10        'invalid_filetype'      => 'The requested filetype, <tt>.%s</tt>, is not allowed in your view configuration file', 
     11        'view_set_filename'     => 'You must set the the view filename before calling render', 
     12        'no_default_route'      => 'Please set a default route in <tt>config/routes.php</tt>', 
    1213        'no_controller'         => 'Kohana was not able to determine a controller to process this request: %s', 
    1314        'page_not_found'        => 'The page you requested, <tt>%s</tt>, could not be found.', 
  • trunk/system/libraries/View.php

    r2377 r2492  
    2929         * @return  object 
    3030         */ 
    31         public static function factory($name, $data = NULL, $type = NULL) 
     31        public static function factory($name = NULL, $data = NULL, $type = NULL) 
    3232        { 
    3333                return new View($name, $data, $type); 
     
    4343         * @return  void 
    4444         */ 
    45         public function __construct($name, $data = NULL, $type = NULL) 
     45        public function __construct($name = NULL, $data = NULL, $type = NULL) 
     46        { 
     47                if ( ! empty($name)) 
     48                { 
     49                        // Set the filename 
     50                        $this->set_filename($name, $type); 
     51                } 
     52 
     53                if (is_array($data) AND ! empty($data)) 
     54                { 
     55                        // Preload data using array_merge, to allow user extensions 
     56                        $this->data = array_merge($this->data, $data); 
     57                } 
     58        } 
     59 
     60        public function set_filename($name, $type = NULL) 
    4661        { 
    4762                if (empty($type)) 
     
    6277                        $this->kohana_filetype = empty($this->kohana_filetype) ? $type : $this->kohana_filetype; 
    6378                } 
    64  
    65                 if (is_array($data) AND ! empty($data)) 
    66                 { 
    67                         // Preload data using array_merge, to allow user extensions 
    68                         $this->data = array_merge($this->data, $data); 
    69                 } 
    70  
    71                 Log::add('debug', 'View Class Initialized ['.$name.']'); 
    7279        } 
    7380 
     
    181188        public function render($print = FALSE, $renderer = FALSE) 
    182189        { 
     190                if (empty($this->kohana_filename)) 
     191                        throw new Kohana_Exception('core.view_set_filename'); 
     192 
    183193                if (is_string($this->kohana_filetype)) 
    184194                {