![]() |
View Parser - How to pass variable parameter in the route template plugin - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: View Parser - How to pass variable parameter in the route template plugin (/showthread.php?tid=79940) |
View Parser - How to pass variable parameter in the route template plugin - Seb - 08-20-2021 I'm playing with the appstarter example and the View Parser service provided plugins. In the template, I'm struggling with the route plugin in a loop substitution. Each time the slug must be added to the linked article. The link is build with the route plugin based on a named route. The route is defined as this (just add the name parameter to the example) : app/Config/Routes.php PHP Code: $routes->get('news/(:segment)', 'News::view/$1', ['as' => 'newsArticle']); and the template use the route plugin like this : app/Views/index.html Code: <p><a href="{+ route newsArticle {slug} +}">View article</a></p> This does not generate a ci4 exception error but the parsing is partial and incorrect. I tried with the {slug} outside the plugin, but then as a parameter is missing inside the route plugin a Invalid Parameter error is thrown. As plugins are processed before variable substitution (as mentioned in the doc), I can't figure out how to used the route plugin with variable parameters. Any clue and/or code example ? RE: View Parser - How to pass variable parameter in the route template plugin - titounnes - 02-03-2022 i got same problem. |