Re: [SMARTY] need help with executing own function

From: Date: Tue, 18 Jan 2005 16:59:11 +0000
Subject: Re: [SMARTY] need help with executing own function
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12173@lists.php.net to get a copy of this message
thanks panu for ur suggestion on db join query. i got ur other reply. your approach is correct. it would be very much easier to specify that in a db and later just do a join query to get the desired result. but actually the $car problem was just a imaginary proramming scenario i created to explain what i wanted to do. the bottom line is that i want to execute my function on a var so that the template will display the return value of my function. just like capitalize or date_format or truncate etc etc etc.. i've been reading the manual over and over again.. i think i have missed out something on my function. i read about this in the manual: --begin quote-- The plugin functions inside the plugin files must be named as follows: smarty_type,name_() --end quote-- i'm gonna try that now. On Tue, 18 Jan 2005 16:16:28 +0100, Panu <panu@colorplaza.com> wrote: > zuhaimi zainal wrote: > > now, car_type are integers.. it does not contain the actual car type. > > before i use smarty, this can easily done by creating a function to > > translate the car_type to its respective type. ie: car_type 1 is for > > sedan, car_type 2 is for hatchback etc etc.. like this > > --begin code-- > > <td>Car Type: </td><td><?php echo getCarType($car->car_type) > > ?></td> > > Hmm my previous reply didn't reach the list... > > I hope you have the cartype (Sedan, cabriolet, etc) in a database. That > way you could just use join the get all required information to the db > result object and can assign the value in Smarty. > > Why you wan't to use Smarty for something that is done much easier in PHP? > > --- > :[ Panu ]: > On a tombstone: "I TOLD YOU I WAS SICK" > -- When you signup for PayPal, you can start accepting credit card payments instantly. As the world's number one online payment service, PayPal is the fastest way to open your doors to over 40 million member accounts worldwide. Best of all, it's completely free to sign up! To sign up or learn more, click here: https://www.paypal.com/row/mrb/pal=ET694X3JAP9X2

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