Categories > TinyButStrong general >

How do I execute a object method

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: fpirson
Date: 2005-09-21
Time: 15:33

How do I execute a object method

So I have a graph object. I would like to execute the show() method. How can I do that in the template


[var.graph.show()] doesn't work ($graph->show() normally in php)

thanks a lot

By: Skrol29
Date: 2005-09-21
Time: 15:42

Re: How do I execute a object method

If your method is supposed to return a string, then [var.graph.show] should work.
By: fpirson
Date: 2005-09-21
Time: 16:24

Re: How do I execute a object method

ok thank you but mine method create a image witch the gd librairy. In fact I generate a image dynimically ...
By: Skrol29
Date: 2005-09-21
Time: 17:17

Re: How do I execute a object method

Ok, si just calling $graph->Show() may be not enougth. I suppose you'd like to return the image path in the template.

I suggest you use a custom onformat function.
Example:

HTML:
  <img src="[var.graph;onformat=m_display_graph]">

PHP:
function m_display_graph($FieldName,&$CurrVal) {
  $CurrVal->Show();
  $CurrVal = CurrVal->fullpath;
}
By: fpirson
Date: 2005-09-22
Time: 08:34

Re: How do I execute a object method

ok I will try that. Thank you for your help