RE: [SMARTY] new plugin: mailto

From: Date: Tue, 21 May 2002 20:50:56 +0000
Subject: RE: [SMARTY] new plugin: mailto
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4343@lists.php.net to get a copy of this message
Just a minor performance note here: in this code snippet for ($i=0; $i<count($mail_parms); $i++) { $mail_parm_vals .= (0==$i) ? '?' : '&'; $mail_parm_vals .= $mail_parms[$i]; } count() is called once for each loop iteration. Obviously in this context that is only a couple of times. But in larger loops, this can become expensive. Another way to do it would be to call count once, assign the value and put the value in the for loop expression. -----Original Message----- From: Jason Sweat [mailto:jsweat_php@yahoo.com] Sent: Tuesday, May 21, 2002 11:39 AM To: Smarty General; Monte Ohrt Subject: Re: [SMARTY] new plugin: mailto Monte, That looks great. Nice piece of functionality. Might I suggest adding the following to accomodate cc, bcc and subject? //these lines should be placed after the $text assignment //and before the encode check $mail_parms = array(); if (!empty($cc)) { $mail_parms[] = 'cc='.rawurlencode($cc); } if (!empty($bcc)) { $mail_parms[] = 'bcc='.rawurlencode($bcc); } if (!empty($subject)) { $mail_parms[] = 'subject='.rawurlencode($subject); } $address .= $mail_parm_vals; __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.smarty.general (#4343) next »