On Tue, 29 Jun 2004 14:16:16 +0300, Maris <[EMAIL PROTECTED]> wrote:
> 
> 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
> }

Perhaps:

function create_object($class, $name){
  $obj = new $class();
  $this->assign($name, $obj);
}

> 
> Thanks,
> Maris
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> !DSPAM:40e14d8b133258412246093!
> 
> 




-- 
paperCrane --Justin Patrin--

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

Reply via email to