Author |
Message |
Topic: smarty 3.1RC clearAssign error |
Loki
Replies: 2
Views: 4613
|
Forum: Bugs Posted: Wed Jul 20, 2011 6:21 pm Subject: smarty 3.1RC clearAssign error |
$smarty->assign('test', '123');
echo $smarty->fetch('foo.tpl');
$smarty->clearAssign('test');
$smarty->assign('test', '456');
echo $smarty->fetch ... |
Topic: Different bases for relative paths |
Loki
Replies: 2
Views: 15330
|
Forum: Smarty Development Posted: Fri Jul 08, 2011 3:28 pm Subject: Different bases for relative paths |
/root/sub/bar.tpl
{include file="../foo.tpl"} {*try to load template in root*}
{include file="foo.tpl"} {*try to load template in sub*}
... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Fri Jul 08, 2011 8:52 am Subject: Problem with compile filepath |
I understand you.
But you are not banned using the relative path starting with ../ in the tempaltes.
Maybe better way to use something like open_basedir in php.ini? |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Fri Jul 08, 2011 8:29 am Subject: Problem with compile filepath |
/templates/bar.tpl
/templates/alpha/bar.tpl
and
$smarty->setTemplateDir(array(
'/templates/alpha',
'/templates/',
));
If you'd call $smarty->fetch('bar.tpl'); ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Fri Jul 08, 2011 8:04 am Subject: Problem with compile filepath |
$smarty->template_dir is an array.
include_path in php.ini also contents several paths and it works well. So it's strange argument about an array. |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Thu Jul 07, 2011 9:27 pm Subject: Problem with compile filepath |
have to be relative to the current working directory (usually a bad idea) or relative to SMARTY_DIR (yet another bad idea).
In previous versions relative path starts from $smarty->template_dir. Ho ... |
Topic: Different bases for relative paths |
Loki
Replies: 2
Views: 15330
|
Forum: Smarty Development Posted: Thu Jul 07, 2011 9:20 pm Subject: Different bases for relative paths |
$template_dir = /some/path
template /some/path/sub/test.tpl
test.tpl
{include file="../main.tpl"}
{include file="main.tpl"}
In the case {include fil ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Thu Jul 07, 2011 5:04 pm Subject: Problem with compile filepath |
Woks strange:
include 'smarty/Smarty.class.php';
$smarty=new Smarty();
//set absolute path for template dir
$smarty->setTemplateDir(dirname(__FILE__).'/ ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Thu Jul 07, 2011 6:09 am Subject: Problem with compile filepath |
I made function canonicalPath (see code of globe at first page) and made some changes in sysplugins/smarty_internal_template.php
In method buildTemplateFilepath I changed all "return $some_file; ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 11:59 am Subject: Problem with compile filepath |
This is not possible as template_dir can be an array which is scanned if you call display('my.tpl');
We need to get the path of the matching array element.
For that reasion we can't skip the test ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 10:03 am Subject: Problem with compile filepath |
Another idea: it may be possible to cache the path of existing templates in the file?
Something like that:
public function buildTemplateFilepath ($file = null)
{
if ($this-& ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 9:49 am Subject: Problem with compile filepath |
Thank you! I will wait. |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 9:35 am Subject: Problem with compile filepath |
Anyway there will be some changes in filepath handling in the upcomming version 3.1.
Can I expect these changes soon in svn? |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 8:58 am Subject: Problem with compile filepath |
Why not simply use a unique way of specifying the template_dir filepathes in your project.....
In the code, I prefer to use absolute paths, so there's no problem - I can bring them to the required ... |
Topic: Problem with compile filepath |
Loki
Replies: 33
Views: 42288
|
Forum: Smarty Development Posted: Wed Feb 02, 2011 8:46 am Subject: Problem with compile filepath |
In the method buildTemplateFilepath already present verification that the path relative. So that verification can be simplified. |
|