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

Unable to load included template-file within a extended template-file #158

Closed
Fivedark opened this issue Jan 11, 2016 · 1 comment
Closed

Comments

@Fivedark
Copy link

After some changes in Smarty from 3.1.27 to 3.1.28 (also 3.1.29) I got errors with my template structure. It isn't possible to include templates relative to an extended template, because the included template will be searched relative to the highest extended template. Use this simplyfied structure to rebuild the problem:

templates 
|-- layout
|     |-- include
|     |      |-- test.tpl
|     |-- page
|     |      |-- page.tpl
|     |-- layout.tpl
|-- index.tpl

index.tpl

{config_load file="test.conf" section="setup"}

<HTML>
<HEAD>
    <TITLE>{$title} - {$Name}</TITLE>
</HEAD>
<BODY bgcolor="#ffffff">
    {block name='content'}

    {/block}
</BODY>
</HTML>

layout.tpl

{extends file='../index.tpl'}

{block name='content'}
    <section id="main">
        {block name='main'}
        {/block}
    </section>

    <aside>
        {include file="./include/test.tpl"}
    </aside>
{/block}

page.tpl

{extends file='../layout.tpl'}

{block name='main'}
    Page-Content
{/block}

test.tpl

TEST

You will get the following:Fatal error: Uncaught --> Smarty: Unable to load template file './include/test.tpl' in 'file:../index.tpl' <-- thrown in /srv/www/paul.dev.ls.local/stand-alone-pages/tests/smarty/libs/sysplugins/smarty_internal_template.php on line 139

@uwetews
Copy link
Contributor

uwetews commented Jan 27, 2016

The bugfix is now in the master branch and will later be included in 3.1.30

@uwetews uwetews closed this as completed Jan 27, 2016
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