How do I use $_GET["something"] ?

PreFiX

Member
Code:
<?php

class prefixaddon_Route_Prefix_Public implements XenForo_Route_Interface
{
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $action = $router->resolveActionWithStringParam($routePath, $request, 'string_id');
        $action = $router->resolveActionAsPageNumber($action, $request);

        $actions = explode('/', $action);

        switch ($actions[0])
        {
            case 'informacija':    $controller = 'Informacija';        break;
            default:            $controller = 'Pagrindinis';
        }

        return $router->getRouteMatch('prefixaddon_ControllerPublic_'.$controller, $action, 'paslaugos');
    }

    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        $actions = explode('/', $action);

        switch ($actions[0])
        {
            case 'serveris':        $intParams = 'serveris_id';        $strParams = 'serveris_url';            break;
            case 'paslauga':        $intParams = 'paslauga_id';        $strParams = 'paslauga_url';            break;
        }

        $action = XenForo_Link::getPageNumberAsAction($action, $extraParams);

        if ($intParams)
        {
            return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, $intParams, $strParams);
        }
        else
        {
            return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, $strParams);
        }
    }
}
Hello, I'm novice. But I already did something with tutorials

But I don't understand how do I should use $_GET["anything"] on xenforo any help?

with link like http://example.com/Controller/Something.Value
http://example.com/Controller/Something.Value/AnotherString.AnotherValue
 
$value1 = $this->_input->filterSingle('input_key_name', 'input_key_type');

For input_key_type, you should look XenForo_Input to get list of type XF supported.
 
As I understand from your code, in array $actions first item is action, the rest are key.value combinations for parameters, right?

Then use this in your router:

Code:
switch (array_shift($actions))
{
   // your old code here
}

foreach ($actions as $pair)
{
   $pair = explode('.', $pair, 2);
   if (count($pair) == 2)
   {
        $request->setParam($pair[0], $pair[1]);
   }
}
then in controller check input as @Nobita.Kun mentioned above
 
As I understand from your code, in array $actions first item is action, the rest are key.value combinations for parameters, right?

Then use this in your router:

Code:
switch (array_shift($actions))
{
   // your old code here
}

foreach ($actions as $pair)
{
   $pair = explode('.', $pair, 2);
   if (count($pair) == 2)
   {
        $request->setParam($pair[0], $pair[1]);
   }
}
then in controller check input as @Nobita.Kun mentioned above

I trying this thing for a while. But I can't still understand, it's not working for me at all. Can you give me full code of example of Router? and Controller?
 
Top Bottom