snytkine / LampCMS

Open source Question and Answer program similar to StackOverflow and Quora in PHP + MongoDB. Follow @snytkine on Twitter
http://support.lampcms.com
324 stars 104 forks source link

pass category id to "Ask" link #76

Open snytkine opened 12 years ago

snytkine commented 12 years ago

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.