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

Problem with extend common view #19

Closed
ozee31 opened this issue Mar 2, 2016 · 4 comments
Closed

Problem with extend common view #19

ozee31 opened this issue Mar 2, 2016 · 4 comments

Comments

@ozee31
Copy link
Contributor

ozee31 commented Mar 2, 2016

Hi,

I have a problem with Extending Views.

I have a layout default.tpl

<!DOCTYPE html>
<html>
<head>...</head>
<body>
    <header>
        {% if auth %}
            {% element 'nav' %}
        {% endif %}
        {{ _view.fetch('header')|raw }}
    </header>

    <section id="{{ page_id }}" class="js-container container-fluid">
        <div>
            {{ Flash.render()|raw }}
        </div>

        {{ _view.fetch('content')|raw }}
    </section>
</body>

In Common have a view content_sidebar.tpl

<div class="row">
    <div class="col-lg-2 col-md-3" style="background-color:green; height: 200px;">
        Sidebar
        {{ _view.fetch('sidebar')|raw }}
    </div>

    <div class="col-lg-10 col-md-9" styles="background-color:red; height: 200px;">
        Content
        {{ _view.fetch('content')|raw }}
    </div>
</div>

Extends this view in Users/view.tpl doesn't works

First test

{% extends 'Common/content_sidebar' %}

{{ _view.start('sidebar') }}
    <p>Hi</p>
{{ _view.end() }}

<p>Plop</p>

Result :
A template that extends another one cannot have a body in "/var/www/html/app/src/Template/Users/view.tpl" at line 6.

Second test

{{ _view.extend('/Common/content_sidebar') }}

{{ _view.start('sidebar') }}
    <p>Hi</p>
{{ _view.end() }}

<p>Plop</p>

Result :
Display just

Plop

, no display Common's view

Thank you for your help

@WyriHaximus
Copy link
Collaborator

@ozee31
Copy link
Contributor Author

ozee31 commented Mar 3, 2016

Ok think you

@ozee31 ozee31 closed this as completed Mar 3, 2016
@WyriHaximus
Copy link
Collaborator

Let me know how it works out. Planning to add information like this to the readme/docs soon, your input is appreciated 👍

@ozee31
Copy link
Contributor Author

ozee31 commented Mar 3, 2016

It's a good idea

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

2 participants