need help with executing own function

From: Date: Tue, 18 Jan 2005 08:19:53 +0000
Subject: need help with executing own function
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12167@lists.php.net to get a copy of this message
hi folks, i've just started using smarty. i think its great but i do find some difficulty adjusting to it. right now i'm stuck. i'm sure its quite a simple one so please bear with me. what do i need to do in smarty so that i can execute my own function on a template var? take a look at this situation.. let say in my template: --begin code-- <td>Car Type: </td><td>{$car->car_type}</td> <td>Displacement: </td><td>{$car->car_cc}</td> --end code-- $car is being assign value from a db query result (car_type, car_cc are table columns) 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> --end code-- with the function getCarType returning the actual car type. but how do i do it (the getCarType function) now in the template with smarty? fyi, all my functions are in one separate file. tia, zuhaimi -- 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 (#12167) next »