Categories > TinyButStrong general >

Bug when calling php functions

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Meinerbur
Date: 2007-04-14
Time: 15:28

Bug when calling php functions

Consider following tbs-tag:
[var.html.menu_entry('index.php','Home')]

where html is a global variable holding an object with a method menu_entry which has 2 parameters.

I get the error message:
TinyButStrong Error in field [var.html.menu_entry('index.php','Home')...] : item menu_entry('index' is neither a method nor a property in the class 'html'

Why?
In function meth_Locator_FindTbs at line 779 the following line of code is used to seperate portions of the path:
$Loc->SubLst = explode('.',$Loc->SubName);

Sure, it doesn't recognize that the dot is part of the argument.

What can I do?

Regards,
Meinersbur
By: Skrol29
Date: 2007-04-15
Time: 02:36

Re: Bug when calling php functions

Hi Meinerbur,

The problem is not the dot (.) but the quotes (').
The correct syntaxe should be
[var.html.menu_entry(index.php,Home)]

It can looks weird. But [var] fields supporting functions and methods is just a limited feature. The TBS syntax does not pretend and does not want to be a structured language for templates. Complex calls or calculations are supposed to be prepared at the PHP side.
By: Meinerbur
Date: 2007-04-15
Time: 03:07

Re: Bug when calling php functions

Thanks for the answer. But I don't agree that the quotes are the Problem.

[var.html.menu_entry(index.php,Home)]
does not work either although it might be the 'more correct' syntax.

But the single page are useful since
[var.html.menu_entry(index=2Ephp,Home Page)]
does not work but
[var.html.menu_entry('index=2Ephp','Home Page')]
does! However, the single quotes will be passed to the function as part of the arguments.

Regards,
Meinersbur
By: Meinerbur
Date: 2007-04-15
Time: 03:30

Re: Bug when calling php functions

Sorry, "single quotes" not "single page"

Regards,
Meinersbur
By: Skrol29
Date: 2007-04-17
Time: 00:30

Re: Bug when calling php functions

I have to look at this behavior.