Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force resolve of packages view #74

Closed
garygreen opened this issue Jan 6, 2014 · 3 comments
Closed

Force resolve of packages view #74

garygreen opened this issue Jan 6, 2014 · 3 comments

Comments

@garygreen
Copy link

Take for instance you use a package that has its own views and would like to override a main layout view with your own (to add more navigation links, etc). The package view uses blocks in the view to allow overriding.

To override the packages view in Laravel, you have the following structure in your app:

Package structure:

/views
    /layouts
       admin.twig

admin.twig contains for instance:

{% block main_navigation %}
     Link 1
     Link 2
{% endblock %}

Your main app structure:

/app
    /views
        /packages
            /vendor
                /package_name
                    /layouts
                        admin.twig

admin.twig contains:

{% extends 'package_name::layouts.admin' %}
{% block main_navigation %}
     {{ parent() }}
     Link 3
{% endblock %}

When rendering the view, it will render the above however the extend in this instance will cause an endless loop as it will continue to resolve package_name::layouts.admin to the /app/views/packages/vendor/package_name

My question is, is there anyway to 'force' it to resolve the packages view? If not, maybe it would be worthwhile adding a prefix to force a resolve? i.e use > to represent always resolve the packages view?

 {% extends '>package_name::layouts.admin' %}
@garygreen
Copy link
Author

Or rather to keep the similar syntax {% extends 'package_name>>layouts.admin' %}

@rcrowe
Copy link
Owner

rcrowe commented Jan 10, 2014

Hi @garygreen

To be honest, there hasn't really been much thinking about loading templates from packages (other than simple templates). So it is likely very broken.

Though I've fallen behind on 0.6, this is something I want to improve. I'll add it as a todo.

@rcrowe rcrowe mentioned this issue Jan 10, 2014
10 tasks
@rcrowe rcrowe mentioned this issue Jun 19, 2014
12 tasks
@barryvdh
Copy link
Collaborator

Does this still happen in 0.6? Wouldn't really think so, because we now use the Laravel ViewFinder to load the templates.

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

No branches or pull requests

3 participants