noiselabs / SmartyBundle

Smarty3 template engine bundle for Symfony
http://smartybundle.readthedocs.io/
GNU Lesser General Public License v3.0
51 stars 36 forks source link

invalid filename on windows system for compiled templates #1

Closed winus closed 12 years ago

winus commented 12 years ago

I opened a issue at smarty, but i also apply's to the SmartyBundle project. Please take a look at: http://code.google.com/p/smarty-php/issues/detail?id=79

Greetings

Winus

vitorbrandao commented 12 years ago

Hello @winus. Thanks for using SmartyBundle and reporting this issue.

As Uwe wrote in the Smarty bugtracker the ':' is used for resources. That's why SmartyBundles uses the following syntax that will use a specific lookup function to load the "real" filename:

{extends 'file:AcmeHelloBundle:Default:layout.html.tpl'}

or a syntax using a native Smarty method:

{extends 'file:[AcmeHelloBundle]/Default/layout.html.tpl'}

I have not tried this in Windows. Can you confirm syntax 1 does not work as expected? Thanks.

winus commented 12 years ago

I can confirm the first syntax errored on windows. On my mac i wasnt running into problems untill a developer on windows machine joint the team. His machine had the problem.

Regards

Winus

winus commented 12 years ago

Wrong button pushed;) accedently closed the issue..

vitorbrandao commented 12 years ago

I'll look at it to check if there is something UNIX specific in the code. In the meantime please use the 2nd syntax.

Note: Right now I'm working on Symfony2 Forms support. If you see any other important features lacking on SmartyBundle you may create an issue for it with the label Feature Request and will check it. Thanks.

vitorbrandao commented 12 years ago

@winus still having problems in Windows, when using the Bundle:Controller:action syntax? In want to close all open bugs before 0.2, hoping to fix this one too if possible.

winus commented 12 years ago

Sorry for the delay, it is still a problem on windows, but smarty doesn't validate/normalize the resource name for it's compiled versions... still think it is a smarty problem, and my patch in smarty still works fine here :)

vitorbrandao commented 11 years ago

@winus What patch are you referring to?

winus commented 11 years ago

I have made a small patch in my smarty library which seem to work fine. Smarty_resource.php, line 146

$compiled->filepath = $_compile_dir . $_filepath . '.' . $compiled->source->type . $_basename . $_cache . '.php';
if (Smarty::$_IS_WINDOWS) {
       $compiled->filepath = preg_replace('/:/', '.', $compiled->filepath);
}