How do i get the Url Query String with Dynamic Parameters into Volt to create pagination

I have follwoing query string generated by a "search form"

results?pagefrom=18&pageto=30&country=2&state=&city=0&keyword=&status=all&cmd=basic_search&Submit=Start+Searching

I need to know how do i get this into the pagination generation in volt like below

<li class="previous"><a href="/search/results?page={{ page.before }} & NEEDS TO ADD ABOVE QUERY AS IT IS HERE TO WORK ">Previous</a></li>

There is no easy way to do that. I suggest you to make some custom method to parse current get params and add pagination.



10.4k

You can't get that from the Request object on page load? I don't work in volt, so I'm not sure of the lifecycle, but it seems that on page load you can get the querystring params from the request object and set them as local variables inside of the controller.

$this->request->getQuery() in controller and then pass it to volt.

@Jurigag, you can use {{ request.getQuery() }} in volt, so you don't need to pass it from controller

Well i dont like using something like this in view. I think it should be passed from controller but yea you can do it like this too.