8.4.1 passing value to view() via URL works in Dashboard single page but not in block
Permalink
I pass a value from view to controller's view via the URL in a Dashboard single page.
Dashboard single page view:
Dashboard single page controller:
My block controller view() is the same as the Dashboard single page controller view(). And my block's view.php:
where the /cars page has a block of cars list and links to car categories (same as the topic list). So when you click on the category it should go to the selected car category page view, i.e. /cars/1 should show only those cars with category ID = 1.
The code works perfectly in the Dashboard but not in the block. When it goes to /cars/1, it says Page Not Found. If I explicitly set the category ID in the controller '$cars->setCategoryID(1);' - this works!
What's wrong in the block?
Thank you.
Dashboard single page view:
Dashboard single page controller:
public function view($categoryID = null) { $cars = new CarList(); $cars->setCategoryID($categoryID); $cars->setItemsPerPage(10); $paginator = $cars->getPagination(); $pagination = $paginator->renderDefaultView(); $this->set('cars', $paginator->getCurrentPageResults()); $this->set('pagination', $pagination); $this->set('paginator', $paginator);
My block controller view() is the same as the Dashboard single page controller view(). And my block's view.php:
where the /cars page has a block of cars list and links to car categories (same as the topic list). So when you click on the category it should go to the selected car category page view, i.e. /cars/1 should show only those cars with category ID = 1.
The code works perfectly in the Dashboard but not in the block. When it goes to /cars/1, it says Page Not Found. If I explicitly set the category ID in the controller '$cars->setCategoryID(1);' - this works!
What's wrong in the block?
Thank you.
I changed the block's view categories URLs:
and added an action function to the controller:
FYI:https://documentation.concrete5.org/developers/working-with-blocks/c...