hutch2323
New member
Hello again,
I've encountered another problem with XF 2.0. I'm trying to query my database from a node and display the results on that page. I've done some research, but I think I'm getting some of the syntax from earlier versions of XF mixed in and its not working. Currently, I have a PageNode.php file located in the \src\addons\Callback2 directory. This is the code used in PageNode.php:
On the node page, under the Template HTML section, I have the following:
Finally, the PHP callback is:
Callback2\PageNode::myfunction
When visiting the page though, no results are displayed. I really have no idea what the issue is here. Thanks for your time!
I've encountered another problem with XF 2.0. I'm trying to query my database from a node and display the results on that page. I've done some research, but I think I'm getting some of the syntax from earlier versions of XF mixed in and its not working. Currently, I have a PageNode.php file located in the \src\addons\Callback2 directory. This is the code used in PageNode.php:
PHP:
<?php
namespace Callback2;
class PageNode
{
public static function myfunction()
{
$db = \XF::db();
$results = $db->fetchAll('
SELECT *
FROM `xf_user`
');
$response->params['results'] = $results;
}
}
?>
On the node page, under the Template HTML section, I have the following:
HTML:
<xf:foreach loop="{$results}" value="{$result}">
{xf:raw $result.content}
</xf:foreach>
Finally, the PHP callback is:
Callback2\PageNode::myfunction
When visiting the page though, no results are displayed. I really have no idea what the issue is here. Thanks for your time!