Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Extending templates with relative paths - wrong template!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
ImpossibleProject
Smarty n00b


Joined: 17 Oct 2013
Posts: 1

PostPosted: Thu Oct 17, 2013 8:06 am    Post subject: Extending templates with relative paths - wrong template! Reply with quote

I have a strange issue that started occurring over the last days - possibly, this isn't even a bug but something I'm misunderstanding about the way Smarty extends works with relative paths.

In our setup, we have a number of directories with a layout.tpl File and subdirectories with specific templates that extend the layout.

For example:
Code:

invoices/layout.tpl
invoices/gmbh/directsale.tpl <= extends the invoices/layout.tpl
emails/layout.tpl
emails/loyalty/bonus.tpl <= extends the emails/layout.tpl


All these extends are handled using
Code:
{extend file="../layout.tpl"}

in the respective template.

Now, we are starting to see the strange situation where the pre-compiled bonus.tpl has a dependency on the invoices/layout.tpl, and vice versa.

Clearing the templates_c Folder generally solves the problem for a while, but then another "bad" compile happens and creates a messed up template again.

The result of this is not pretty: sometimes, invoices suddenly miss the body, in other cases, emails sent to customers show a broken invoice body with no content. This is a really serious issue, and any help on this would be much appreciated.

What could be causing Smarty to sometimes load a template to extend from the wrong path (i.e. not the path where the extends is used)?
Is there a good alternative to using relative include paths for extending templates to circumnavigate this issue?

Any help would be much appreciated.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Oct 18, 2013 1:52 pm    Post subject: Reply with quote

It's the same problem as here http://www.smarty.net/forums/viewtopic.php?t=24590

The error could occur if the same relative path is used in different context.

The fix is in the SVN.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP