RE: [SMARTY-DEV] Trouble compiling tpl from resource plugin
| From: | Gary Loescher | Date: | Tue, 16 Jul 2002 13:44:51 +0000 |
| Subject: | RE: [SMARTY-DEV] Trouble compiling tpl from resource plugin | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-186@lists.php.net to get a copy of this message | ||
Yup, sure is.
>-----Original Message-----
>From: Monte Ohrt [mailto:monte@ispi.net]
>Sent: Tuesday, July 16, 2002 8:29 AM
>To: Gary Loescher
>Cc: smarty-dev@lists.php.net
>Subject: Re: [SMARTY-DEV] Trouble compiling tpl from
>resource plugin
>
>
>$_filename is supposed to be just the name of the file,
>no path. Is
>basename() leaving the "w:" part on there?
>
>Monte
>
>Gary Loescher wrote:
>> Hi folks,
>>
>> Smarty version: CVS on 7/15
>> Platform: Win2k
>>
>> I wrote a resource plugin with the same functionality as
>> Smarty's "file" resource, so that later I can swap it
>> for a database resource without changing the prefixes in
>> my code (ie $smarty->display('site:index.tpl') ).
>>
>> The problem I was having was with compiling templates.
>> Smarty was producing compiled files with 0 bytes and
>> names that looked like "site", with no template name or
>> extension. I tried it with the db plugin, and it did the
>> same thing.
>>
>> It seems to be happening in _get_auto_filename. The colon
>> is causing Windows to choke. My solution was to urlencode
>> the filename, here:
>>
>> // prepend N in case crc32 was negative to avoid possible
>> // OS issues with directory names starting with a "-"
>> $_crc32 = 'N' . substr($_crc32,0,3) . $_dir_sep . 'N'
>. $_crc32;
>> $res .= $_crc32 . urlencode($_filename) . '.php';
>> ^^^^^^^^^^^^^^^^^^^^^
>>
>> It seems to work...anything wrong with this?
>>
>> Gary
>>
>
>
>
>--
>Monte Ohrt <monte@ispi.net>
>Director of Technology, ispi Inc.
>
>
>--
>Smarty Development Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>