What binds a controller to a single page view?
Permalink
To add a new single page, I go to /dashboard/pages/single/single_page_added and add one. But I get an error as the page doesn't yet exist yet, so I add public/application/single_pages/my_single_page.php and all is good. But now I want a controller, so I add public/application/controllers/single_page/my_single_page.php, and call the class MySinglePage. Sometimes it takes and sometimes only the view is rendered without the controller ever being called.
https://documentation.concrete5.org/developers/pages-themes/working-... states:
Important Bug and Compatibility Note.... If you experience difficulty following these instructions, build your single pages into a package.
Is there some sort of special order one needs to add the view and the controller? How does C5 determine whether they are bound? Not sure but seems like single words without hyphen are less pragmatic.
Thanks!
EDIT. For unknown reasons, once I added an argument to my controller, it now is being executed. While my immediate issue is solved, I would really like to know why this was required. Thank you in advance.
https://documentation.concrete5.org/developers/pages-themes/working-... states:
Important Bug and Compatibility Note.... If you experience difficulty following these instructions, build your single pages into a package.
Is there some sort of special order one needs to add the view and the controller? How does C5 determine whether they are bound? Not sure but seems like single words without hyphen are less pragmatic.
Thanks!
EDIT. For unknown reasons, once I added an argument to my controller, it now is being executed. While my immediate issue is solved, I would really like to know why this was required. Thank you in advance.
<?php namespace Application\Controller\SinglePage; use Concrete\Core\Page\Controller\PageController; class UsersManual extends PageController { public function view($topicId = 1) { } }
Often this will happen when you add a controller after you have already added a Single Page, most of the time if you go back to the Single Pages dashboard and "Refresh" your page it will pick up the controller.
Thanks hutman, So changing view() to view($topicId=1) had nothing to do with it? Well, that makes me feel better.
I don't think that had anything to do with it, I would guess it was more likely something internal that re-checked for a controller when you added params to the URL