I just found some Laravel Forum posts explaining ways of doing templating
- http://forums.laravel.com/viewtopic.php?id=531 - Routes
- http://forums.laravel.com/viewtopic.php?id=839 - Controllers
And this blog article:
Pregunta
So, I was wondering which is the best way include a single view (views/login.blade.php
) into a layout loader, so I won't have to repeat all the code again.
This is my route that loads the login view:
Route::get('login', function() {
return View::make('login');
});
And I've read the Templating in Laravel but they talk about controllers or blade layouts, no routes layout.
Any idea?
Solución 2
I just found some Laravel Forum posts explaining ways of doing templating
And this blog article:
Otros consejos
You could instead use the controller route so that you have something like
Route::get('login', array('uses' => 'login@index'))
And in your login controller you have
class Login_Controller extends Base_Controller {
public $restful = true;
public function get_index()
{
return View::make('login');
}
}
I like to use it like that:
login page is extending content section of main layout. I like login pages with full page (navigation, header etc.)