Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Extending templates with relative paths - wrong template!

 
Post new topic   Reply to topic    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: 5052
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
OliveWillis
Smarty Rookie


Joined: 18 Jan 2017
Posts: 5

PostPosted: Wed Jan 18, 2017 12:05 pm    Post subject: Reply with quote

I found your post site on google and examine a couple of of your early posts. Proceed to maintain up the excellent operate. I simply additional up your RSS feed to my MSN Information Reader. Looking for ahead to studying extra from you later on!ÖI'm often to postging and i actually admire your content. The article has really peaks my interest. I am going to bookmark your web site and hold checking for new information.
___________
Our Scottsdale lawyers practice in all of the following areas: DUI & DWI defense, domestic violence, drug offenses, assault cases, homicides, white collar crime, motorcycle accidents, auto accidents, medical malpractice, wrongful death, car accidents, and slips & falls.
dui lawyer phoenix
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    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