Welcome Guest, Not a member yet? Register   Sign In
View Parser - How to pass variable parameter in the route template plugin
#1

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 ?
Reply
#2

i got same problem.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB