Using the C5 router with views
Permalink
Wish to try views while routing, and am looking at https://documentation.concrete5.org/developers/routing/views... .
On this section of code directly from the documentation, Concrete\Core\View\View::setThemeHandle() is not a valid function. Concrete\Core\View\View::getThemeHandle() and Concrete\Core\Page\Theme\Theme::setThemeHandle() are both valid however, but not the one in the documentation. Please advise what needs to be changed. Also, what is the purpose of the unused $factory object?
Directly after this block of code, the documentation states the following:
That’s it! The HTML found at application/views/account/activate/form.php will be rendered, placed into the print $innerContent; found in application/themes/green_salad/view.php, just like what happens when working with single pages
Where are application/views/account/activate/form.php and application/themes/green_salad/view.php located? They do not exist for both my instance as well ashttps://github.com/concrete5/concrete5....
Thank you
On this section of code directly from the documentation, Concrete\Core\View\View::setThemeHandle() is not a valid function. Concrete\Core\View\View::getThemeHandle() and Concrete\Core\Page\Theme\Theme::setThemeHandle() are both valid however, but not the one in the documentation. Please advise what needs to be changed. Also, what is the purpose of the unused $factory object?
$router->get('/account/activate', function() use ($app) { $factory = $app->make(\Concrete\Core\Http\ResponseFactoryInterface::class); $view = new \Concrete\Core\View\View(‘/account/activate/form’); $view->setThemeHandle(‘green_salad’); $contents = $view->render(); return new \Concrete\Core\Http\Response($contents); });
Directly after this block of code, the documentation states the following:
That’s it! The HTML found at application/views/account/activate/form.php will be rendered, placed into the print $innerContent; found in application/themes/green_salad/view.php, just like what happens when working with single pages
Where are application/views/account/activate/form.php and application/themes/green_salad/view.php located? They do not exist for both my instance as well ashttps://github.com/concrete5/concrete5....
Thank you
Hello again,
Anyone? If what I am asking is unclear, please let me know.
Thank you
Anyone? If what I am asking is unclear, please let me know.
Thank you
instead of setThemeHandle you need to use
$view->setViewTheme('green_salad');
I had a hard time getting this to work with a custom route but it works now.
However, my view.php depends on a valid page object - now I have to restructure that to enable these custom routes...
Another option I am already using is to create single pages and single page routes as they use the same page object and view as the single page itself.
$view->setViewTheme('green_salad');
I had a hard time getting this to work with a custom route but it works now.
However, my view.php depends on a valid page object - now I have to restructure that to enable these custom routes...
Another option I am already using is to create single pages and single page routes as they use the same page object and view as the single page itself.
I have the really simple single page on the dashboard. But now I wish to add some routes which will either respond with JSON (got all that working) or return with the dashboard with the #ccm-dashboard-content-inner DIV having the appropriate HTML. I tried the router below but it is obviously worng.
Thank you for any help.
Single Page