1. 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?

Discussion in 'XenForo Development Discussions' started by Jake Hakoda Shirley, May 26, 2012.

  1. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    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?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    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?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yes that's possible.
     
  5. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member

    Alright! :) So here is how my callback is set up:
    PHP:
    class Hungercraft_recentgames
    {
        public static function 
    respond(XenForo_ControllerPublic_Abstract $controllerXenForo_ControllerResponse_Abstract $response)
        {
       
            
    $response->params['games'] = $games;
            
    $response->templateName 'hc_recentgames';
        }
    }
    Could you help me set this up in this context?

    I tried this:
    Code:
    $var1 = $controller->_input->get('var1');
    But it's complaining with this:
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The context is a little different for a callback function like this.

    Try this:

    Code:
    $var1 = $controller->getInput()->filterSingle('var1', XenForo_Input::UINT);
    
     
    CurveGotti likes this.
  7. Jake Hakoda Shirley

    Jake Hakoda Shirley Active Member


    Works like a charm, thanks a 1000!
     

Share This Page