Categories > TinyButStrong general >

2 Objects

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: k0ev
Date: 2006-04-10
Time: 21:41

2 Objects

Hi Skrol!

Thanx for great product.

I have some little problem. How I can pass to template 2 different instances of 2 different classes.

for example

class A
{
    var $a = "first class A" ;
}

class B
{
    var $b = "first class B" ;
}

$clsA = new A ;
$clsB = new B ;

$tpl->ObjRef = &$clsA ;

but how to pass also $clsB? I want to get in template values of
$clsA->a and $clsB->b

Thanx
By: Skrol29
Date: 2006-04-11
Time: 00:38

Re: 2 Objects

Hello K0ev,

If you do:
$tpl->ObjRef['obj_a'] = &$clsA;
$tpl->ObjRef['obj_b'] = &$clsB;

The it should work, and you can access to the intances using:
[var.~obj_a.a]
[var.~obj_b.b]
By: k0ev
Date: 2006-04-11
Time: 19:46

Re: 2 Objects

It's works! Thanx Skrol! really flexible and powerful tool!