Re: [SMARTY-DEV] Trouble compiling tpl from resource plugin
| From: | Monte Ohrt | Date: | Tue, 16 Jul 2002 13:29:24 +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-185@lists.php.net to get a copy of this message | ||
$_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';-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.^^^^^^^^^^^^^^^^^^^^^It seems to work...anything wrong with this? Gary