Categories > TinyButStrong general >

Access class constants from template

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Manuel
Date: 2007-07-01
Time: 19:36

Access class constants from template

Hello,
I'm using TBS 3.2.0 with PHP 5.1.2.

I want to use my own object within a template, so I included them by doing
$tpl->ObjectRef['myobj'] =& myobj;

Hence, accessing a class constant of this object doesn't work. TBS throws an error message. So I checked the code and inserted the following couple of lines into function "meth_Locator_Replace", line 902:
elseif (defined(get_class($Value) . '::' . $x)) {
$x =& constant(get_class($Value) . '::' . $x);
}

Now it works. Do you consider adding this functionality (not neccessary my solution :-)) to a bugfix? Problem is: I'd like to license my software under BSD, which is not possible if I modify the TBS-code and use it (then I am bound to LGPL).

Cheers - thank you
Manuel
By: sheepy
Date: 2007-07-03
Time: 10:10

Re: Access class constants from template

I don't think there's a problem with that - you change the tbs, which remains LGPL. Then you can link it up with your program which will be in BSD.  Your part will be in BSD and TBS will be in LGPL, and you can distribute them together.
By: martijn
Date: 2007-07-03
Time: 13:51

Re: Access class constants from template

I don't think there's a license problem between LGPL and BSD, if you at least clearly state which part of your product has which license.
By: Skrol29
Date: 2007-07-04
Time: 00:42

Re: Access class constants from template

Hi,

I agree with Sheepy and Martijn about the license.

I add your feature request in the todo of the next version.