Re: [SMARTY-DEV] More accurate compiled file names
| From: | Robert Amos | Date: | Sun, 30 May 2004 01:04:35 +0000 |
| Subject: | Re: [SMARTY-DEV] More accurate compiled file names | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2329@lists.php.net to get a copy of this message | ||
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