Browse Source

refactoring view compilation.

Taylor Otwell 13 years ago
parent
commit
d9201be431
3 changed files with 12 additions and 3 deletions
  1. 1 1
      laravel/config/container.php
  2. 11 2
      laravel/view.php
  3. 0 0
      storage/views/.gitignore

+ 1 - 1
laravel/config/container.php

@@ -80,7 +80,7 @@ return array(
 	{
 	{
 		require_once SYS_PATH.'view'.EXT;
 		require_once SYS_PATH.'view'.EXT;
 
 
-		return new View_Factory($c->resolve('laravel.composer'), VIEW_PATH);
+		return new View_Factory($c->resolve('laravel.composer'), VIEW_PATH, STORAGE_PATH.'views/');
 	}),
 	}),
 
 
 
 

+ 11 - 2
laravel/view.php

@@ -9,6 +9,13 @@ class View_Factory {
 	 */
 	 */
 	public $path;
 	public $path;
 
 
+	/**
+	 * The path to the application storage directory.
+	 *
+	 * @var string
+	 */
+	public $compiled;
+
 	/**
 	/**
 	 * The view composer instance.
 	 * The view composer instance.
 	 *
 	 *
@@ -21,12 +28,14 @@ class View_Factory {
 	 *
 	 *
 	 * @param  View_Composer  $composer
 	 * @param  View_Composer  $composer
 	 * @param  string         $path
 	 * @param  string         $path
+	 * @param  string         $compiled
 	 * @return void
 	 * @return void
 	 */
 	 */
-	public function __construct(View_Composer $composer, $path)
+	public function __construct(View_Composer $composer, $path, $compiled)
 	{
 	{
 		$this->path = $path;
 		$this->path = $path;
 		$this->composer = $composer;
 		$this->composer = $composer;
+		$this->compiled = $compiled;
 	}
 	}
 
 
 	/**
 	/**
@@ -279,7 +288,7 @@ class View {
 		// For simplicity, compiled views are stored in a single directory by the MD5 hash of
 		// For simplicity, compiled views are stored in a single directory by the MD5 hash of
 		// their name. This allows us to avoid recreating the entire view directory structure
 		// their name. This allows us to avoid recreating the entire view directory structure
 		// within the compiled views directory.
 		// within the compiled views directory.
-		$compiled = $this->factory->path.'compiled/'.md5($this->view);
+		$compiled = $this->factory->compiled.md5($this->view);
 
 
 		// The view will only be re-compiled if the view has been modified since the last compiled
 		// The view will only be re-compiled if the view has been modified since the last compiled
 	 	// version of the view was created or no compiled view exists. Otherwise, the path will
 	 	// version of the view was created or no compiled view exists. Otherwise, the path will

+ 0 - 0
storage/views/.gitignore