snytkine/LampCMS — Issue #76: pass category id to "Ask" link
Author: snytkine
Created: 2012-01-22 13:38:08+00:00
State: open

When "Ask" is clicked from the category view page we should pass that category id or slug to the ask controller. The reason for that is we can then make the current category 'selected' in the ask form.

One way to do this is set categoryId instance variable then the code that generates navigation tabs will use it when creating the link for the "Ask" tab.

Another way is to pass it in session, then every page view we can set the value of category_id if it's available. This will work even from the view question page. So if user viewing question then clicks on "Ask", it will make the category of previously viewed question as "selected"

Another way is to point link to relative ask/ instead of absolute /ask/ url. Then can modify rewrite rules so that if url looks like /category/mycategory/ask/ it will pass the value of 'mycategory' to controller. Then a more generic rewrite rule will rewrite anyurl followed by ask/ to the ask controller.