Categories > TinyButStrong general >

using object functions for data values

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: fakefur
Date: 2010-12-22
Time: 14:54

using object functions for data values

according to the documentation this should work:

in the php file:

<?php
... here include th tmplate file and instantiate a TBS object etc etc ...
$x = new objX();
$x->getdata();    // x also has a superclass public method called "draw"
$TBS->ObjectRef["x"] = & $x;
$TBS->Show();
?>

and in the template file:

[onshow.~x.draw]

but all i get is:

TinyButStrong Error in field [onshow.~fpi.draw...]: 'draw' is a method and the current TBS settings do not allow to call methods on automatic fields

either i am completely misunderstanding the documentation (quite possible) or something is broken

any clues?
thanks
:)
By: Skrol29
Date: 2010-12-22
Time: 22:42

Re: using object functions for data values

Hi,

You're right, the manual missed to talk about this setting.
Set
$TBS->MethodsAllowed = true;
and your snippet should work correctly.

This restriction has been added since TBS 3.5.0 for security reasons.
The manual has to talk about that.
By: fakefur
Date: 2010-12-22
Time: 22:44

Re: using object functions for data values

thank you!!
:)
By: fakefur
Date: 2010-12-24
Time: 21:08

Re: using object functions for data values

just wanted to say thanks agin for a really great template library
i am beginning to rewrite my main website to use tbs and will use it for future projects
:)