Trouble compiling tpl from resource plugin
| From: | Gary Loescher | Date: | Tue, 16 Jul 2002 07:49:27 +0000 |
| Subject: | Trouble compiling tpl from resource plugin | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-184@lists.php.net to get a copy of this message | ||
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