Found the solution:

function create_car($params){
 global $smarty;
 $car = new Car("Jeep sWrangler","black");
 $smarty->register_object($params[id], $car);

}




"Maris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi there!
>
> I am trying to make a PHP function "create_object" that would allow me to
> create a class instance with supplied name
>
> Here's the Smarty code snipset I would like to use my function in:
>
> {* Let's create a new class object with name "car" *}
> {create_object id=$id_car name="car"}
>
> {* When it is created, we can print out its properties or do whatever we
> need to *}
> The brand is: {$car->brand}
> and car's color is: {$car->color}
>
>
>
> Any ideas how to create PHP function that would allow to create the
instance
> so I can
> operate with it in Smarty as shown above?
>
> function create_object($id, $name){
>    //help needed
> }
>
>
> Thanks,
> Maris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to