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

include breaks block content / template extending #215

Closed
fox34 opened this issue Apr 12, 2016 · 4 comments
Closed

include breaks block content / template extending #215

fox34 opened this issue Apr 12, 2016 · 4 comments

Comments

@fox34
Copy link

fox34 commented Apr 12, 2016

Including extending files in an extended file is not possible any more (was working as of Smarty 3.1.13, I do not know the latest working version).

PHP Version: 7.0.4 (seems to be version independent down to 5.4)
Smarty: 3.1.29

Given the following scenario (see attached files for an example):

include-sample.zip

Templates:

  • templates/start.tpl
  • templates/start-extended.tpl (extends start.tpl, as the name states)
  • templates/included.tpl
  • templates/included-extended.tpl (extends included.tpl, as the name states)

Including "included-extended.tpl" in "start.tpl" leads to wrong block values when displaying start-extended.tpl: start-extended.tpl will be completely ignored.

Example 1

start.tpl:

{include file="included-extended.tpl"}
{block "foo"}This is block "foo" in start.tpl{/block}

start-extended.tpl:

{extends "start.tpl"}
{block "foo"}This is block "foo" in start-extended.tpl{/block}

included.tpl:

{block "bar"}This is block "bar" in included.tpl{/block}

included-extended.tpl:

{extends file="included.tpl"}
{block "bar"}This is block "bar" in included-extended.tpl{/block}

Expected output of start-extended.tpl:

This is block "bar" in included-extended.tpl
This is block "foo" in start-extended.tpl

Real output of start-extended.tpl:

This is block "bar" in included-extended.tpl
This is block "foo" in start.tpl

Example 2

start.tpl:

{* include file="included-extended.tpl" *}
{block "foo"}This is block "foo" in start.tpl{/block}

The other files have not been changed.

Output start-extended.tpl (this is the expected behavior):


This is block "foo" in start-extended.tpl

Example 3

Smarty version 3.1.13
Same code as in example 1, this is the expected behavior:

This is block "bar" in included-extended.tpl
This is block "foo" in start-extended.tpl
@fox34
Copy link
Author

fox34 commented Apr 12, 2016

On first sight, this seems to be related with #200.

@uwetews
Copy link
Contributor

uwetews commented Apr 12, 2016

Updated comment:
{extends file="included.tpl"} in included-extended.tpl does create a new template inheritance root as intended, but it should not reset the outer level inheritance for block "foo". I will try to fix it ASAP

@uwetews
Copy link
Contributor

uwetews commented Apr 13, 2016

This bug is fixed in the master branch and will later be included in 3.1.30

@uwetews uwetews closed this as completed Apr 13, 2016
@fox34
Copy link
Author

fox34 commented Apr 13, 2016

Thanks for your quick reaction and bugfix. Now working as intended. 👍

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