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

Path issues starting with Smarty 3.1.9 - normalizePath()

 
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 -> Bugs
View previous topic :: View next topic  
Author Message
bkraul
Smarty Rookie


Joined: 13 Oct 2011
Posts: 10

PostPosted: Wed Sep 19, 2012 2:26 pm    Post subject: Path issues starting with Smarty 3.1.9 - normalizePath() Reply with quote

I am trying to figure out the reasoning behind adding of the function normalizePath(), found in smarty_resource.php. From the comments on the function I see that it addresses windows environments, but I don't understand why.

I am having a rather annoying issue in Windows, using an apache server.

Prior to 3.1.9, resource directories such as template_dir would remain as set. Because I develop for Linux environments, I try to use *nix paths all through my application, since Windows can work well like that.

But from 3.1.9, presumably because of this function, my paths are now corrupted. For example, if I set my template_dir to:

Code:
/templates/chrome/


when I use {$smarty.current_dir} in my template (stored in /templates/chrome) shows up as:

Code:
/templates/chrome\


and it screws up the page because the path, having mixed forward and backward slashes, is not valid in windows. This affects all smarty path variables. Is there any way to turn this off? Maybe a setting to force the / instead of \ ?

Thanks for your help.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Sep 19, 2012 7:55 pm    Post subject: Reply with quote

Smarty does use the systems directory separator which is '\' under windows.

You can overwrite this by
Code:
define('DS', '/');

befor you include Smarty.class.php
Back to top
View user's profile Send private message
bkraul
Smarty Rookie


Joined: 13 Oct 2011
Posts: 10

PostPosted: Wed Sep 19, 2012 8:00 pm    Post subject: Reply with quote

You are the man! That did it. Simple enough fix to include in my core include.

Thanks for the fast response.
Back to top
View user's profile Send private message
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 -> 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