I'm developing my custom page, where I want to show some questions in a list.
Everything works fine, except for one thing. Each question on my list doesn't have a link. It's just empty and looks like this:
<a href="">Question title</a>
I retrieve questions with this function:
public function process_request($request)
{
$qa_content = qa_content_prepare();
$qa_content['title'] = 'Page title';
$questions = qa_db_select_with_pending(qa_db_qs_selectspec(null, 'created', 0, null, null, false, false, null));
$qa_content['q_list']['qs'] = $questions;
return $qa_content;
}
var_dump($qa_content['q_list']['qs']) gives me this:
[1418] => Array
(
[postid] => 1418
[categoryid] => 4
[type] => Q
[basetype] => Q
[hidden] => 0
[queued] => 0
[acount] => 2
[selchildid] =>
[closedbyid] =>
[upvotes] => 0
[downvotes] => 0
[netvotes] => 0
[views] => 565
[hotness] => 73206600000
[flagcount] => 0
[title] => Question title
[tags] => tags list
[created] => 1626604501
[name] =>
[categoryname] => Category Name
[categorybackpath] => categorypath
[categoryids] => 4,4
[userid] => 14
[cookieid] =>
[createip] =>
[points] => 730
[flags] => 0
[level] => 0
[email] => user@email.com
[handle] => Nickname
[avatarblobid] =>
[avatarwidth] =>
[avatarheight] =>
[_order_] => 49
)
What am I doing wrong?
Update
I figured out, that ['url'] is missing from my array, so just before return in my function, I've added this:
foreach($qa_content['q_list']['qs'] as $key => $value)
{
$url = qa_q_path($value['postid'], $value['title'], false);
$qa_content['q_list']['qs'][$key]['url'] = $url;
}
Is this approach right? It solves the problem, but shouldn't qa_db_qs_selectspec() function create URLs on its own?