Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
in Q2A Core by
I want to display for example questions with most views (questions?sort=views) or unanswered questions in index (homepage) page how can do that ?

1 Answer

+3 votes
Best answer

Assuming you're in Q2A 1.4, use $QA_CONST_PATH_MAP in qa-config.php to map the questions or unanswered page to the home page, for example:

  'questions' => '',
Then, if necessary, you can change the default sort order in qa-page-questions.php by adding this line before switch ($sort):
if (!isset($sort)) $sort='views';
You'll also need to change qa_qs_sub_navigation() in qa-app-q-list.php to add an explicit sort parameter onto the 'recent' item, like in the other items.
I'm trying to do "/hot" page and tried to add 'questions' => 'hot', in QA_CONST_PATH_MAP but /question page just turns to hot page, but i need to display /hot content in index page. Thanks.
In that case you want to use this:
'hot' => '',
I think i'm don't understand something (or i'm not expressing my thoughts correctly in english), however i'm replaced all qa-page-default.php code with qa-page-hot.php code and i got exatly what i'm wanted. Is that action is not harmfull to anything, can couse something odd (code security or something other) ?
Yes, that should work too, until you upgrade Q2A.
This is so simple! :) I used that map just to renamed the links, didn't think of using it that way. Maybe you should put that in the method's comment Gidgreen! Works like a charm.