Passing multiple parameters to the add-on


Active member
A personal goal of mine is to write my first add-on, and I have a number of existing projects from which to start. They're actually conversions of php/mysql projects I had created years ago. The question I basically want to ask is, if I cannot process multiple parameters from the URL to/from the add-on, what are some other approaches I could consider?

To better understand my problem, here's some background on one of the projects. I run a website for a competitive fighting game (the Virtua Fighter series), and provide the command list (or moves list) for all the playable characters as a resource:

It's a mysql back-end, with a php front-end. In the header, users may select the game version and character (from that game) of interest. As well as displaying the character's moves, there is some filtering functionality accessed by clicking on the "Filter" link to expose a mini form from. Additionally, users can sort on any column by clicking on the column header.

The simple URL for a character's command list would be:

Parameters required:
  1. Character (chara)
  2. Game version (ver)

But if you've got filtering and sorting applied, then the URL gets much busier:

Parameters required:
  1. Character (chara)
  2. Game version (ver)
  3. Sort Order (order)
  4. Sort Direction (sort)
  5. Query type (q)
  6. Comparitor (c)
  7. Value (v)

I'm still very much in the learning phase of XenForo add-ons, but in reading the thread URL's with multiple parameters it appears as though I would have great difficulty using one of the resolveAction* to handle this kind of thing, assuming it were even possible?

One alternative I've yet to explore is to relegate all the filtering/sorting functions to be javascript based, which would only leave me with the Game Version and Character parameters to process. The downside would be that users couldn't permalink to customised views with filters/sort applied.

Would greatly appreciate any thoughts on how I could approach this.


Active member
To answer my own question on how to access the parameters passed via the URL:

$input = $this->_input->filter(array(
'var1' => XenForo_Input::STRING,
'var2' => XenForo_Input::INT
Then passing $input to the model's method makes the array members accessible (e.g. $input['var1']).

Looking at class Xenforo_Input (library/Xenforo/Input.php) reveals more.