Re: Probs with Windows paths
| From: | Monte Ohrt | Date: | Tue, 29 Jan 2002 18:48:06 +0000 |
| Subject: | Re: Probs with Windows paths | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-2607@lists.php.net to get a copy of this message | ||
As per the docs, you must start your file path with "file:", so try
this:
{include file="file:F:/www/servers/..."}
Otherwise, you may have a conflict if your resource type is named "F"
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: monte@ispi.net
> To unsubscribe send a blank email to $subst('Email.Unsub')
> Visit Smarty's homepage at
> http://www.phpinsider.com/php/code/Smarty/
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/