RE: [SMARTY-DEV] Trouble compiling tpl from resource plugin

From: Date: Tue, 16 Jul 2002 16:05:16 +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-192@lists.php.net to get a copy of this message
Heh. I was just writing an email to suggest this same code. Great minds, Jason :) Looks like we're stuck with munged filenames again, or a performance hit. Personally, the filename doesn't bother me. I actually like being able to easily identify the resource used to get the template. In the "file:c:/foo.tpl" case, though, I guess that the price for using an absolute path would be funny-looking compiled template names. ;) Seems to me using an absolute path is a bad practice, anyway. Gary >-----Original Message----- >From: Jason Sweat [mailto:jsweat_php@yahoo.com] >Sent: Tuesday, July 16, 2002 10:36 AM >To: smarty-dev@lists.php.net; gary@loescher.org; monte@ispi.net >Subject: Re: [SMARTY-DEV] Trouble compiling tpl from >resource plugin > > >What about this ? >if ($offset=strpos($string,':')) { > $offset++; >} >$match = substr($string,$offset); > > >>>>>>>>>>> >Well we may have to use urlencode instead of trying to >get the filename. >preg_match and preg_split are get what we want but are >much slower. > >repeated 100,000 times: > >urlencode(basename($string)); --> 2.920 >secs > >preg_match('![^:|/\\\\$]!',$string,$match); --> 7.627 >secs >explode(':',basename($string)); --> 5.436 secs > >The second two get it right, but they take much >longer. Unless there are >any other ideas? > >Monte > >__________________________________________________ >Do You Yahoo!? >Yahoo! Autos - Get free new car price quotes >http://autos.yahoo.com > >-- >Smarty Development Mailing List (http://smarty.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.dev (#192) next »