Closed paclucio closed 2 years ago
Hi @paclucio
It appears that the docs are obsolete. The alias
and build
functions have been refactored a long time ago.
Here's how they work:
echo $f3->build('/produto/@pid', ['pid'=>'foo']); // /produto/foo
echo $f3->build('/produto/@pid/*', ['pid'=>'foo','*'=>'bar']); // /produto/foo/bar
echo $f3->build('/produto/*/@pid/*', ['pid'=>'foo','*'=>['bar','baz']]); // /produto/bar/foo/baz
In other words, you should pass an argument named *
with:
So in your example, you should rewrite your code like this:
<a href="{{ 'product', 'pid='. @product.productid .',*='. \Web::instance()->slug( @product.title ) | alias }}">
or
<a href="{{ 'product', [ 'pid' => @product.productid, '*' => \Web::instance()->slug( @product.title ) ] | alias }}">
Thank you very much @xfra35
Used your second more elegant solution.
Good luck!
Hi all,
As the title says, alias filter does not replace wildcard, only the named token as per docs
F3:
3.7.3
and3.8.0
Route:GET @product: /produto/@pid/* = \Controllers\Viewport->product
HTML:<a href="{{ 'product', 'pid='. @product.productid .',2='. \Web::instance()->slug( @product.title ) | alias }}" title="{{ @product.title }}">
It renders
http://domain.stg/produto/meP9UCfv/*
Thank you.