Get arguments of single page in package controller

Permalink
Hi,

I want to get the arguments of a single page within a package controller.
The page is /dashboard/users/search/view/3/. In this case the (single)page controller is /dashboard/users/search/ where the method is view and the argument is 3.
In my package controller I want to get the 3.

Any ideas?

Best,

Corretje

DeWebmakers
 
JohntheFish replied on at Permalink Reply
JohntheFish
For single page controllers, its usually as simple as:
public function view($number){
}

(and the rest happens by magic)

For block controllers its a bit more complicated. Best example to crib is in the core page list block controller.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Hi John,

Thanks for answering. I know howit works in a single page controller. But I need to do this in an event within a new package controller.

namespace Concrete\Package\MyNewPackage
use ...
class Controller extends Package {
    function on_start() 
    {
        // get params / arguments for page /dashboard/users/search/view/3
        ...
    }
}


Best,

Corretje
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
That is an on_start method.
Within that you need to register an on_start event handler.
Once inside the on_start event handler you can get the current page and request objects.
DeWebmakers replied on at Permalink Reply
DeWebmakers
Of course! Sorry!
I got it working. Thank you.