Re: [SMARTY-DEV] OpenDir problem

From: Date: Fri, 05 Apr 2002 16:55:42 +0000
Subject: Re: [SMARTY-DEV] OpenDir problem
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-45@lists.php.net to get a copy of this message
It is fairly easy to change Smarty to use appropriate separator. However, it would be faster to use built-in DIRECTORY_SEPARATOR constant instead of figuring it out from PHP_OS and storing separator in $this->_separator, due to access times of class variables. But DIRECTORY_SEPARATOR is only available in PHP 4.0.6 and later, so I am not sure if we want to start requiring that version of PHP for Smarty. On Fri, 05 Apr 2002, Manfred Roos wrote: > Hi Everybody, > > Short abstract for readers with little time: > Smarty has a problem generating it's internal paths for different operating > systems. > > I had an 'OpenDir' Warning in Smarty.. > After I have tracked down the problem now and I would like to discuss it > with you and the solution for it > > > The system showed the following warnings: > ============================== > Debug Warning: smarty\Smarty_Compiler.class.php Zeile 1284 - OpenDir: > Invalid argument (errno 22) > Debug Warning: smarty\Smarty_Compiler.class.php Zeile 1285 - Supplied > argument is not a valid Directory resource > Debug Warning: smarty\Smarty_Compiler.class.php Zeile 1305 - Supplied > argument is not a valid Directory resource > > > I tried to track down the problem and included some 'echo'. > Used code to track down the problem in SMARTY_COMPILER.CLASS.php > ===================================================== > /*===========================================*\ > Function: _load_filters > Purpose: load pre- and post-filters > \*===========================================*/ > function _load_filters() > { > $plugins_dir = SMARTY_DIR . $this->plugins_dir; > echo "<b>smarty_dir</b> ".SMARTY_DIR."<br>"; > echo "<b>this->plugins_dir</b> > ".$this->plugins_dir."<br>"; > echo '<b>$plugins_dir</b> '.$plugins_dir."<br>"; > > > What you get: > =========: > smarty_dir c:\apache\htdocs\development\includes\smarty/ > this->plugins_dir plugins > $plugins_dir > c:\apache\htdocs\development\includes\smarty/plugins > > So you can see that by generating 'smarty_dir' a slash instead of an > backslash was appended. This caused all my problems. > > As you can easily derive from c:/apache/... , I am using Smarty in a > Windows based development environment. It works fine. The production side > will be hosted on a Linux system. Therefore the source code should work on > both systems without change. This would be the perfect solution. > > My question: > Is there a variable I can set to influence whether a '/' or a ,\' is > appended? Or must there be a change somewhere in the coding? > Strange enough: I did not change the default settings and other paths like > the templates and templates_c directory are found on the windows > environment. Are they generated differently? > > P.S.: Looking through the mailing list for similar problems, I found an > email like 'the config files entries seem to be lost in certain situations'. > This could have the same reason (wrong path generation) . > > Bye > manfred > > > > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -Andrei * Unix is user friendly, it is just chooses its users selectively. *

« previous php.smarty.dev (#45) next »