I get a page object from a page view event and then try to get its action and parameters but the action returns empty. The page is ‘items’, action is ‘item’, parameter is ‘123’, i.e. /items/item/123. What’s wrong here?
@Myq please have a loo at the very first post - I need to get the viewed page URL action and parameters in the event listener. I’ve tried both a PageController and a BlockController to get the action and they both return empty.
Looks like changing the event to on_before_render and getting $page = Page::getCurrentPage(); got me the page action and parameters, although not what I expected.
The page is ‘items’, action is ‘item’, parameter is ‘123’, i.e. /items/item/123. I have this in the controller:
public function action_item($handle = null)
{
$this->runAction('item');
if ($handle) {
$this->view($handle);
}
}