aah cool your code is much cleaner smile thx alot smile

ok I know it's crappy PHP, but it works for now smile

$nieuwsid = $_GET['nieuwsid'];

$result = $db->query('
    SELECT 
    * FROM '.$db->prefix.'posts 
    WHERE topic_id = '.$nieuwsid.'
    ORDER BY id DESC LIMIT 1
    ') or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());



if ($db->num_rows($result)) {
    $cur_post = $db->fetch_assoc($result);
    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);

    $result = $db->query("SELECT * FROM ".$db->prefix."topics WHERE id = ".$nieuwsid."")  or error('Unable to fetch topics', __FILE__, __LINE__, $db->error());
    $cur_topic = $db->fetch_assoc($result);

    $tpl->newBlock( "NIEUWS" );
    
    $tpl->assign( "NIEUWS_TITLE", pun_htmlspecialchars($cur_topic['subject']) );
    $tpl->assign( "NIEUWS_VIEWS", $cur_topic['num_views'] );
    $tpl->assign( "NIEUWS_DATUM", format_time($cur_post['posted']) );
    $tpl->assign( "BERICHT", $cur_post['message'] );
    
    $tpl->gotoBlock( "_ROOT" );
} else {
    $tpl->newBlock( "ERROR" );
    $tpl->assign("ERROR", "Er is geen nieuwsitem gevonden.");
    $tpl->gotoBlock( "_ROOT" );
}

actually no wink
the content of the first post smile (the content of the newsitem itself)

Am trying a few query's but I took a look at the query's from the newsplugins and got confused and dazzled by the joins, and mixes of wheres in the querys..

it looks like its going to work smile but it just startled me with my limited experience with mysql :S

Hi everyone,

I have tried the newsplugins and am hapy with those, accept, they all work on a while loop with one or more forums.
I do not wish to display all the news on the frontpage, but only the title, date etc.. with a link to a new page wich in turn displays the newsitem itself.

but now I came to a stagering halt, because i got a little confused from al the joins and wheres in the query's :S

My question is...
If i have a topicid, how can I display the topic title, date and message in the new page ?


With regards,

Ronny Roethof
www.dcthoekje.nl