Jake Bunce
Well-known member
In response to a PM, I am posting the answer here.
Code example:
	
	
	
		
This file would be at:
library/Callback/PageNode.php
Then when you edit your page node the callback would be:
Callback_PageNode::myfunction
And you can use {$myrows} in your page template. To display multiple rows you can use a foreach in the page template. Example:
	
	
	
		
				
			Code example:
		Rich (BB code):
	
	<?php
class Callback_PageNode
{
	public static function myfunction(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
	{
		$mydb = new Zend_Db_Adapter_Pdo_Mysql(array(
			'host'     => 'localhost',
			'username' => 'dbuser',
			'password' => 'dbpass',
			'dbname'   => 'dbname'
		));
		$myrows = $mydb->fetchAll("
			SELECT *
			FROM mb_bans
		");
		$response->params['myrows'] = $myrows;
	}
}
	This file would be at:
library/Callback/PageNode.php
Then when you edit your page node the callback would be:
Callback_PageNode::myfunction
And you can use {$myrows} in your page template. To display multiple rows you can use a foreach in the page template. Example:
		Code:
	
	<xen:foreach loop="$myrows" value="$myrow" i="$i" count="$count">
	{$myrow.field1}, {$myrow.field2}, {$myrow.field3}
</xen:foreach>