Reputation: 45
This is the code
<a href="{{ 'questions' | page({Filter[search] : 1}) }}">{{category.name}}</a>
It should generate an URL like
http://localhost/vos-questions?Filter[search]=1&Filter[categories]=3&Filter[sort]=published_at+desc
but is not working! if I try to use 'Filter[search]' : 1
instead, the URL is generated but without the Filter params.
The destination page ('questions') is defined with a :page param, the Filter params are not defined.
title = "questions"
url = "/vos-questions/:page?"
What am I doing wrong ?
Upvotes: 0
Views: 61
Reputation: 9693
hmm it will not work
your url is like this url = "/vos-questions/:page?"
so page
must be the argument and it will be consider like this
/vos-questions/test => now in code `page` param's value will be `test`
if you really need that url then there is better solution.
// question page
title = "questions"
url = "/vos-questions" <- we remove param here as we pass it manually
// now html code
<a href="{{'questions'|page }}?Filter[search]=1&Filter[categories]=3&
Filter[sort]=published_at+desc">{{category.name}}</a>
it should work as expected it will generate url like this
http://localhost/vos-questions/?Filter[search]=1&Filter[categories]=3&Filter[sort]=published_at+desc
and if you want to pass dynamic values you can also do like this
// suppose $search = 2 in code and $cat = 30
<a href="{{'questions'|page }}?Filter[search]={{ search }}
&Filter[categories]={{ cat }}
&Filter[sort]=published_at+desc">{{category.name}}</a>
so generated url will be
now in code you can get this values using Input
https://octobercms.com/docs/services/request-input
$filter = \Input::get('Filter');
echo $filter['categories']; // => 30
if any doubts please comment.
Upvotes: 1