Re: Probs with Windows paths

From: Date: Tue, 29 Jan 2002 15:28:20 +0000
Subject: Re: Probs with Windows paths
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-2605@lists.php.net to get a copy of this message
Thanks, I will apply the patch with one modification: it will do this only if PHP_OS is Windows. On Tue, 29 Jan 2002, gus wrote: > Hi! > > I experienced problems with Smarty and Windows paths with drive letters (Smarty > 1.5.2, PHP 4.0.6, Win2K, IIS5). > > When loading a template using the display method I receive the following error: > Warning: Smarty error: unable to read template resource: > "F:/www/servers/test/templates/default/layout.html" in > F:\www\servers\test\portal\smarty\Smarty.class.php on line 1525 > > The reason for this behaviour is that _parse_file_path splits the filename by > the first colon and so detects a wrong resource_type. > > I'll suggest the following patch: > > function _parse_file_path($file_base_path, $file_path, &$resource_type, > &$resource_name) { > > + // Handle Windows filenames with drive letter > + if (strpos($file_path, ':')==1) { > + // no resource type, treat as type "file" > + $resource_type = 'file'; > + $resource_name = $file_path; > + } else > + { > // split tpl_path by the first colon > $file_path_parts = explode(':', $file_path, 2); > > if (count($file_path_parts) == 1) { > // no resource type, treat as type "file" > $resource_type = 'file'; > $resource_name = $file_path_parts[0]; > } else { > $resource_type = $file_path_parts[0]; > $resource_name = $file_path_parts[1]; > } > + } > ... > > > Best regards > gus > > --- > You are currently subscribed to smarty as: andrei@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -Andrei * The future is not what it used to be. *

« previous php.smarty.general (#2605) next »