snytkine / LampCMS

Open source Question and Answer program similar to StackOverflow and Quora in PHP + MongoDB. Follow @snytkine on Twitter

Home Page:http://support.lampcms.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pass category id to "Ask" link

snytkine opened this issue · comments

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.