Skip to content

Conversation

@wegnermedia
Copy link

Hi,

is it possible to implement a View::prependLocation($path) (+ View::setLocation($path)) method?

Use Case:
You create a blog, you use the default location for views. Later you want to implement a "Themer" functionality to change some of the templates without touching/editing the original ones. Right now there is only the addLocation method to append a new location, BUT then only the original template would be loaded first.

Example:

Let's assume we have a blog. And we "make" a view:

View::make('posts.show')->withPost($post);

By default no theme is set, so this view should be called:
app/views/posts/show.blade.php

Now we apply a "Bootstrap" theme, now this file should be called:
app/Themes/Bootstrap/views/posts/show.blade.php

if there is no such file, the original should take place instead.

With View::prependLocation($path) + View::setLocation($path) you could offer a nice and easy way to tackle even deep nested Sub-Theming like:

Look for
app/Themes/Bootstrap/Christmas/views/posts/show.blade.php
Nothing found - look here:
app/Themes/Bootstrap/views/posts/show.blade.php
Nothing found - look here:
app/Themes/Default/views/posts/show.blade.php
Nothing found - look here:
app/views/posts/show.blade.php

(The setLocation method should replace all given view paths with a set of new ones)

Greetings from Munich :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.