Recent Topics

1 Apr 25, 2009 20:46    

What is the right syntax if I want to call plugin's method and pass a DB variable into it?

This returns the error 'Call to a member function my_func() on a non-object'

array(
	'th' => $this->T_('Title'),
	'td' => '% {Obj}->my_func( #title# ) %',
	'order' => 'title',
),

3 Apr 28, 2009 20:25

no idea off the top of my head.

¥

4 Apr 29, 2009 01:23

I'm gonna take a wild guess at this one. Just because I got up late. You want the bit for

'td' => '% {Obj}->my_func( #title# ) %', 

right? So how about first playing with Mister Obj to get #title# then do my_func to it. Like, I'm guessing you want to do something with something's title. Perhaps a post title? So get the title then do my_func until finally you have $my_funced_title. Then you can do

'td' => $my_funced_title, 

or maybe

'td' => '%'.$my_funced_title.'%', 

if the percent thingies are for like a "LIKE" query.

One might think of it as beating the database into submission, but hey if it works and there ain't no laws against it ... ;)

5 Apr 29, 2009 07:13

Thank you guys, I already found a workaround

function td_results_my_func( $var )
{
	global $Plugins;
	$My_Plugin = $Plugins->get_by_code('my_code');
	
	return $My_Plugin->my_func($var);
}
$Results->cols[] = array(
		'th' => $this->T_('Title'),
		'td' => '% td_results_my_func( #title# ) %',
		'order' => 'title',
	);


Form is loading...