Skrol29 / tinybutstrong

TBS is a PHP template engine for pro and beginners. Only 1 class with few methods properties, but it can do may things for any text templates, including HTML and XML. The only engine that enables W3C compliant templates. It has many plugins including OpenTBS.
http://www.tinybutstrong.com
60 stars 18 forks source link

Handle magic method __call in classes merged by MergeBlock. #13

Closed achilleb closed 5 years ago

achilleb commented 5 years ago

Example :

$TBS->MergeBlock('peoples',$class, 'people') ;

If the class $class has no method 'people' but has a __call magic method, this will be handled.

Skrol29 commented 5 years ago

Hello Achille,

$TBS->MergeBlock('peoples',$class, 'people') ;

This line does not check for a method 'people' in the object $class. I think the line should be:

$TBS->MergeField('my_field', $class) ; // template side : [my_field.people]

But then there is a complication with your change submission with:

method_exists($Value,'__call')

because this change will avoid the check properties when the class has a __call function.

I will fix the problem but your submission is not working as is.

Skrol29 commented 5 years ago

Enhancement supported since TBS 3.11.0-beta-4 (release candidate).

Skrol29 commented 5 years ago

Enhancement supported since TBS 3.11.0-beta-4 (release candidate).