Browse Source

Pass directory into View:: file method.

Taylor Otwell 12 years ago
parent
commit
973da34bc0
2 changed files with 7 additions and 6 deletions
  1. 1 1
      application/start.php
  2. 6 5
      laravel/view.php

+ 1 - 1
application/start.php

@@ -92,7 +92,7 @@ Autoloader::directories(array(
 
 Event::listen(View::loader, function($bundle, $view)
 {
-	return View::file($bundle, $view);
+	return View::file($bundle, $view, path('app').'views');
 });
 
 /*

+ 6 - 5
laravel/view.php

@@ -132,20 +132,21 @@ class View implements ArrayAccess {
 	 *
 	 * @param  string  $bundle
 	 * @param  string  $view
+	 * @param  string  $directory
 	 * @return string
 	 */
-	public static function file($bundle, $view)
+	public static function file($bundle, $view, $directory)
 	{
-		$root = Bundle::path($bundle).'views/';
+		$directory = str_finish($directory, DS);
 
-		// Views may have either the default PHP fiel extension of the "Blade"
+		// Views may have either the default PHP file extension of the "Blade"
 		// extension, so we will need to check for both in the view path
 		// and return the first one we find for the given view.
-		if (file_exists($path = $root.$view.EXT))
+		if (file_exists($path = $directory.$view.EXT))
 		{
 			return $path;
 		}
-		elseif (file_exists($path = $root.$view.BLADE_EXT))
+		elseif (file_exists($path = $directory.$view.BLADE_EXT))
 		{
 			return $path;
 		}