Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
297 views
in Q2A Core by
In the "qa-theme-base.php" we have $question['classes'], $question['tags'], $question['url'], $question['title']... And how can I get the question`s categoryname?
by
I don't know but a good way is to put print_r($question) and see what comes out. You'll get something like: Array( 'url' => '123/the-question', 'title' => 'the title' ) and in there will be the one for the category.

1 Answer

+2 votes
by
 
Best answer
should be in $question['raw']['categoryname'].  $question['raw'] will contain all the information about the question that is in the qa_posts database.  If it exists in that table, it will be found in the ['raw'] index - if I am not mistaken.  Here's an example list:

    ["raw"]=>     array(49) {
      ["postid"]=>       string(3) "735"
      ["categoryid"]=>       NULL
      ["type"]=>       string(1) "Q"
      ["basetype"]=>       string(1) "Q"
      ["hidden"]=>       string(1) "0"
      ["acount"]=>       string(1) "4"
      ["selchildid"]=>       NULL
      ["upvotes"]=>       string(1) "1"
      ["downvotes"]=>       string(1) "0"
      ["netvotes"]=>       string(1) "1"
      ["views"]=>       string(2) "55"
      ["hotness"]=>       string(11) "1.01265e+10"
      ["flagcount"]=>       string(1) "0"
      ["title"]=>       string(37) "test post"
      ["tags"]=>       string(12) "test,post"
      ["created"]=>       string(10) "1312232998"
      ["categoryname"]=>       NULL
      ["categorybackpath"]=>       NULL
      ["uservote"]=>       NULL
      ["userflag"]=>       NULL
      ["content"]=>       string(1500) "This is a test post."
      ["notify"]=>       string(1) "@"
      ["updated"]=>       NULL
      ["format"]=>       string(8) "markdown"
      ["lastuserid"]=>       NULL
      ["lastip"]=>       NULL
      ["parentid"]=>       NULL
      ["lastviewip"]=>       string(15) "xxx.xxx.xxx.xxx"
      ["userid"]=>       string(3) "590"
      ["cookieid"]=>       NULL
      ["createip"]=>       NULL
      ["points"]=>       string(2) "36"
      ["isbyuser"]=>       bool(false)
      ["authorlast"]=>       bool(true)
      ["viewable"]=>       bool(true)
      ["answerbutton"]=>       bool(true)
      ["commentbutton"]=>       bool(true)
      ["commentable"]=>       bool(true)
      ["editbutton"]=>       bool(true)
      ["aselectable"]=>       bool(true)
      ["flagbutton"]=>       bool(true)
      ["flagtohide"]=>       bool(false)
      ["unflaggable"]=>       bool(false)
      ["clearflaggable"]=>       bool(false)
      ["hideable"]=>       bool(true)
      ["reshowable"]=>       bool(false)
      ["deleteable"]=>       bool(false)
      ["claimable"]=>       bool(false)
      ["followable"]=>       bool(false)
    }
...