Re: More accurate compiled file names
Robert Amos <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <6.1.1.1.2.20040530105942.01dadf58@caymans> |
Hi,
The compiled templates are saved in filenames that reflect their filename
and content.
The numbers you see there are the result of a crc32() on the contents of
the file (see http://www.php.net/crc32). This is taken to ensure that each
filename is unique, so that two templates called "header.tpl" in different
locations do not overwrite each others compiled template file.
so a file like %%-13/%%-135052920/header.tpl.php should be perfectly
understandable as the compiled template for "header.tpl"
The filenames are split into directories so that on larger smarty
installations, there is no filesystem delay trying to access the files. If
you do not wish to use directories, simply ensure that
$smarty->use_sub_dirs = false and Smarty will automatically substitute /
for ^ in your compiled template files.
Hope this helps.
Regards,
-bok
At 08:31 AM 30/05/2004, you wrote:
>Hello.
>
>Smarty saves its compiled code to files with unreadable names
>(like %%23t2763%%sjhdjsdhjshgd.php). It makes too difficult to
>find fatal error in the template (for example, {$obj->spoon()},
>where spoon is non-existent method).
>
>Attached patch corrects this problem - it replaces "/" by "^" and
>saves the file to temporary location.
>
>Replacement code:
>
>$_filename = preg_replace("{[/\\\\]}s", "^", $_filename);
>$_filename = preg_replace("{[^a-z0-9~!_=.^-]}si", "_", $_filename);
>
>Don't you plan to insert this patch to production version?
>
>--
>Best regards,
> Dmitry Koteroff.
>--
>Smarty Development Mailing List (http://smarty.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php