Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on TumblrEmail this to someone

So you want to change the view path in other word you want to use views from non-standard locations. You can do with Laravel 4.

You can define additional paths to search for views like so :

 View::addLocation('/path/to/search/');

Also, you can register namespace hints link this :

 /* register namespaced view */
View::addNamespace('theme', '/path/to/theme/views');
/* and use it like this */
return View::make('theme::view.name');

Let’s say you want to achieve below folder structure

|-app
 |-themes
  |-admin
   |- login.php
  |-frontend
   |- home.php

Put the following in app/start/global.php
add path for admin theme

 View::addLocation(app('path').'/themes');

register namespace hint for admin

 View::addNamespace('admin', app('path').'/themes/admin');

register namespace hint for frontend

 View::addNamespace('frontend', app('path').'/themes/frontend');

Then call view like the default way,

return View::make('admin.login');
return View::make('frontend.home');

Or you can use view namespace

return View::make('admin::login');
return View::make('frontend::home');