[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    [smarty] Probs with Windows paths
From:       gus <gusmail () gmx ! net>
Date:       2002-01-29 14:39:51
[Download RAW message or body]

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: smarty@progressive-comp.com
To unsubscribe send a blank email to leave-smarty-700385W@lists.ispi.net
Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic