1

Can't figure out how to create a dynamic route for the categories in this format:

site.com/news/category-1-and-category-2-and-category-3 

That would bring the results from these slug categories.

Trying to build a complex query and I'm sure there is bound to be a better way of doing it that.

'news/<categories:.*>/<categorySlugs:{slug}(\-and\-{slug})+>' => ['template' => 'news/index']
1

Have you tried processing the entire slug directly in your template, without setting a complex route? Check for the presence of the string "-and-", split the slug accordingly, build a Category query.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.