I guess I may be disturbing but I still have a problem.
I want to use the output of this in my custom template but the array is automatically giving each messages a digit.
I used print_r($context['ft']) to check this.
array([0] => array([subject] => test [body] => how to yest) [1] => array([subject] => honey [body] => how to honey))
Let's imagine that's all the posts I've got (2).
I want to get them such that if I use
echo '<div>'.$context['subject'] . $context['body'].'</div>';
It'll style each individual posts.
I can't call all the posts with
$context['ft'][0]['subject']
$context['ft'][1][body']
$context['ft'][1]['subject']
$context['ft'][1]['body']
Here is the main code I used
<?
global $context;
$context['ft'] = array();
$query = $smcFunc['db_query']('', "SELECT * FROM {db_prefix}messages");
while ($row = $smcFunc['db_fetch_assoc']($query))
{
$context['ft'][] = array(
'id' => $row['id_msg'],
'subject' => $row['subject'],
'body' => $row['body'],
);
}
Use a foreach Loop ?
foreach($context['ft'] as $id=>$data) {
echo '<div>'.$data['subject'] . $data['body'].'</div>';
}
Thanks, I'll test it