Recent Topics

1 Sep 24, 2008 02:01    

Hi everyone,
I'm triying to do my on Widget. My SkinTag function looks like this:


function SkinTag( $params ) {
global $disp, $Item;
	echo "<h3>----</h3>";
	var_dump($Item);
	echo "<h3>----</h3>";
}

I can install it correctly. Works fine, but If I put and "instance" of this widget on "Sidebar" and another "instance" of this widget on "Sidebar 2" I can see var_dump result on "Sidebar" but on "Sidebar 2" I see


----
bool(false)
----

It looks like $Item "disappear" when its call on "Sidebar 2". Is it a bug or I'm doing something wrong?

I'm using b2evo version 2.4.5.

2 Sep 24, 2008 15:51

Hi everyone!
I find the problem. It was a Skin problem. On page.main.php, posts.main.php and single.main.php there's a while looks like this:


while( $Item = & mainlist_get_item() )

This part of code modified $Item, so at the end $Item is undefined (false). So I put this code after the while:


		// Keep a reference to current Item
		$curItem = $Item;


and this code before the while:


		// Restore reference to current Item
		$Item = $curItem;

F.Y.I.


Form is loading...