PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Template_Flexy » Bug #7620

Flexy compiler tries to write out of copiled dir

Details

Submitted2006-05-13 13:05 UTC
Fromzx2001 at mail dot ru
StatusNo Feedback
PackageHTML_Template_Flexy
PHP VersionIrrelevant
OSAny
Roadmaps(Not assigned)

Comments

[2006-05-13 13:05 UTC] zx2001 at mail dot ru

Description:
------------
Flexy compiler tries to write out of copiled dir when using construction like:
<flexy:include src="../../default/templates/abstractproductspagelet.html"/>

Note "../../" exists in the path, flexy goes out of compiled dir, this leads to permission errors or invalid compiled file location.

As a temporary solution, I modified HTML/Template/Flexy.php near line 362 - forced it to remove "../".

// Ensure we don't go out of compile dir.
$__file = preg_replace('/\\.\\.\\//', '', $file);
$base = $compileDest . $compileSuffix . DIRECTORY_SEPARATOR .$__file;

Test script:
---------------
<flexy:include src="../../default/templates/abstractproductspagelet.html"/>

[2006-06-02 09:34 UTC] zx2001 at mail dot ru

This construct used when we have multiSource = true and use template 'iheritance', i.e.
/themes/default/templates - filled with 'default' templates
/themes/specific/templates - filled with couple of templates which overrides default templates.
Flexy source dir set to array(/themes/specific/templates, /themes/default/templates) so it uses template from default if it's missing from specific.
This allows very flexible theme definition when we just override templates which require modification.

Now, if we want override some template, but not completely, just adding decoration html before and after, we use:

html before....
<flexy:include
src="../../default/templates/abstractproductspagelet.html"/> <!-- includes default template -->
html after.

And it works fine except for compiled file location.

I hope this explains why relative pathes is important. Or another way to include template out of current template directory will be helpful.

Thanks for you hard work.

Max.