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

{include} to be relative to current 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 -> Feature Requests
View previous topic :: View next topic  
Author Message
leanweb
Smarty Rookie


Joined: 27 Oct 2004
Posts: 24
Location: Newark, DE

PostPosted: Tue Sep 26, 2006 7:12 am    Post subject: {include} to be relative to current template? Reply with quote

basically i'm casting another vote in favor of this idea:
c960657 wrote:
Another suggestion for Smarty 3:
When using relative template paths (paths without a leading /) in a template, the path should be treated as relative to the template itself. E.g. if /var/templates/project1/foo/bar.tpl contains {include file="baz.tpl"}, it should include /var/templates/project1/foo/baz.tpl independant of the value of $smarty->template_dir. The reasoning is that a given template may be used in different projects where $smarty->template_dir may differ.

Also, one could argue that absolute template paths should be relative to $smarty->template_dir. Having filesystem-absolute paths in templates is usually bad coding practice, so the "namespace" consisting of paths with a leading slash could be put to better use. If someone wants filesystem-absolute paths, it can still be achieved through a custom resoucetype, "absfile:/usr/local/templates/foo.tpl".

Interpreting relative and absolute paths for non-file resource types should probably be left to the specific resource type implementation.
Back to top
View user's profile Send private message Visit poster's website
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 -> Feature Requests 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