understand php callback


Well-known member
I'm trying to understand php callback but I miss something.

I have to make a new page in xenforo with a form and then manipulate the form's data.

form example:

<form action="#" name="compute" method="post">
        <input type="checkbox" name="won" /><br />
        <input type="text" name="myRank" /><br />
        <input type="text" name="opponentRank" /><br />
        <input type="radio" name="geo" value="national" /><br />
        <input type="radio" name="geo" value="regional"/><br />
        <input type="radio" name="geo" value="provincial" /><br />
        <input type="submit" name="compute" value="Go!" />
        <a href="<?php echo $_SERVER["SCRIPT_NAME"];?>">Refresh</a>
compute data example (same page):
    $points = ($_POST["won"] == "on") ? win($_POST["myRank"], $_POST["hisRank"]) : defeat($_POST["myRank"], $_POST["hisRank"]);
    echo $points;
now It's correct to use Xenforo Page to do something like this or is better make an add-on?


Well-known member
Thank you Floris.
For plug-in do you mean an add-on, right?

So what are the limits of pages?


A product, which is an add-on, in the form of a plugin. Basically we're talking about the same thing.

The limit is: how well can you code it in PHP?

You need to create a route, a controller, a public viewer, and code to handle the submitted data and templates to show different scenarios (form + result + potential error notices)

I made a plugin that lets you add an extra page, this takes care of everything for you, except your custom code, you'd have to edit the template to show the form, and write php code to handle the data that's submitted.

If you want the plugin let me know, I will open a PM with you on this site to get you the .zip
You can find more about the extra page add-on I made here. (just can't register or download from the site).


Well-known member
Well, I'm a a beginner trying to learn.
Oh I think I have your add-on! I can't remember if I was registered to xenfans before the "archiving" or maybe downloaded here. I will try giving an eye on that code.
In case I will PM you.

Thank you again.