• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

POST date or custom page input?

#1
Hey guys, I just made a custom page that outputs the last 10 rows of a MySQL table I have. I was hoping for a pretty easy way to let the user navigate back 'pages' in chunks of 10, so the user can just press an arrow or something and it would load the next 10 rows.

Could someone please explain to me how to get input or any date to my php function as opposed to just sending data from it?
 
#3
Thanks for the response Jake! I am really new to this, so sorry if I don't know exactly what I am talking about.

Right now I just have a class that I use as a php call back for my page. Is it possible to do this GET stuff with just that or do I need to make a full-blown add-on?
 
#5
Alright! :) So here is how my callback is set up:
PHP:
class Hungercraft_recentgames
{
    public static function respond(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
    {
   
        $response->params['games'] = $games;
        $response->templateName = 'hc_recentgames';
    }
}
Could you help me set this up in this context?

XenForo sanitizes the input before calling that function. You can see an example in:

XenForo_ControllerPublic_Login::actionLogin

Code:
$data = $this->_input->filter(array(
'login' => XenForo_Input::STRING,
'password' => XenForo_Input::STRING,
'remember' => XenForo_Input::UINT,
'register' => XenForo_Input::UINT,
'redirect' => XenForo_Input::STRING,
'cookie_check' => XenForo_Input::UINT
));
 
...
 
$userId = $userModel->validateAuthentication($data['login'], $data['password'], $error);
I tried this:
Code:
$var1 = $controller->_input->get('var1');
But it's complaining with this:
Fatal error: Cannot access protected property NodesAsTabs_ControllerPublic_Page::$_input in /home/hungeradmin/hungercraft.net.OLD/library/Hungercraft/overall.php on line 11
 

Jake Bunce

XenForo moderator
Staff member
#6
The context is a little different for a callback function like this.

Try this:

Code:
$var1 = $controller->getInput()->filterSingle('var1', XenForo_Input::UINT);