getting $_GET variables in xenforo

Alright, I just got home.. Say.. do you have skype or something we could chat about this - maybe it could be resolved more quickly?
 
We doesn't seem to be in the same timeframe (GMT+1) here.
I am not very eager in dispatching my Skype sorry.

Wasn't my indication very clear ?

You have to modify your respond function to cleanup and retrieve your $_GET data.
Then pass it along to your other functions that you call in the respond function too.
 
@MtoR I am actually back at attempting this again. I still do not understand how to pass $_POST or $_GET variables into a XenForo page so it can be loaded with queried data based on thats in $_POST or $_GET.. For example as before.. I list of accounts from a separate database with a search bar that a user can search for a name, submit the form, then another page would load with the requested data. I know how to do this in php just fine using $_POST and $_GET.. I do not understand how to get this data with xenforo classes/functions

you mentioned "You have to modify your respond function to cleanup and retrieve your $_GET data." but this is Exactly why I am here in the first place. Because I do not know how to do that.
 
As I said previously, you have to filter the incoming POST or GET data.

Let's imagine your var passed is either $_POST['toto'] or $_GET['toto'], to get it in your respond function, just add this call at the beginning of the function :
PHP:
$totoRetrieved = $controller->_input->filterSingle('toto', XenForo_Input::STRING);

And then call your function :
PHP:
self::get_GlobalList($totoRetrieved);
 
here maybe i can provide an example of code from my project and you can help me with converting it from xenforo i dont know what this controller is.. is that justa standard variable in xf? anyway something like this

PHP:
//players.php
if(isset($_GET['input']) {
  require_once('/inc/player.php');
  $player = new Player($_GET['input']);

  $kills = $player->getTotalKill();
  echo $kills;

example of the class
PHP:
class Player {
private $input;
  function __construct( $input ) {
          $this->input = $id;
      }

    function getTotalKills() {
    $query = //do stuff
    return $query;

  }
 
You'd do this :

PHP:
// I assumed you were retrieving an unsigned (otherwise you'd change UINT to somthg else)
$inputCleaned = $controller->_input->filterSingle('input', XenForo_Input::UINT);

if($inputCleaned)
{
require_once('/inc/player.php');
$player = new Player($inputCleaned);
$kills = $player->getTotalKill();
echo $kills;
}
 
I still cant figure this out @MtoR , can you please help me? Im using the php pagenode callback class and respond function, and in that callback class i have:
PHP:
<?php
class Leaderboards_GlobalList_Callback
{
    private static $leaders = Array();
    private static $output;
   
    private static function get_GlobalList()
    {
        $global_list = new Leaderboards_GlobalList_Query();
        self::$leaders = $global_list->get_GlobalList();
        unset($global_list);
    }

    private static function format_GlobalList()
    {
        self::$output = "";
        if(is_array(self::$leaders) && count(self::$leaders) > 0)   
        {
            foreach (self::$leaders as $leader) 
            {
                self::$output .= '<tr>';   
                self::$output .= '<td width="150">' . $leader['name'] . '</td>';
                self::$output .= '<td width="70">' . $leader['pvp_kills'] . '</td>';
                self::$output .= '<td width="70">' . $leader['pvp_deaths'] . '</td>';
                self::$output .= '<td width="70">' . $leader['current_streak'] . '</td>';
                self::$output .= '<td width="70">' . $leader['max_streak'] . '</td>';
                self::$output .= '</tr>';
            }
        }
        else
        {
            // if some reason the query didn't work output a message to user
            self::$output = "<li> No members found </li>";
        }
        self::$output = '<table id="stats_table"><tr><th>Name</th><th>Kills</th><th>Deaths</th><th>Current Streak</th><th>Best Streak</th></tr>' . self::$output . '</table>';
    }
   
    /**
    * Get the Members by user groups and return the values back to the template
    * @param XenForo_ControllerPublic_Abstract $controller
    * @param XenForo_ControllerResponse_Abstract $response
    */
    public static function respond(XenForo_Controller_Public_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
    {
        $inputRetrieved = $controller->_input->filterSingle('input', XenForo_Input::STRING);
        self::get_GlobalList();
        self::format_GlobalList();
        $response->templateName = "test";        //name of the template to use
        $response->params['output'] = self::$output;        //html text to insert into the template
        $response->params['input'] = $inputRetrieved;
    }
}
?>
It gives me errors because I just dont understand how this zend stuff works.
 
Top Bottom