Topic: Slimmed down version of extern.php

Is there a slimmed down version of extern.php that just lets you pass a thread no. and then outputs that thread, having been through the various filters/parsers etc. ?

I'm keen to use such a script to publish articles on my site by putting them in the first port of a topic. Extern.php kind of does this but shows all messages in a specified forum and not a post from a specified thread. I guess I need a slimmed down version of extern.php but I just don't have the expertise to work out exactly what extern.php is doing (I have tried!).

Thanks

--Alan

Re: Slimmed down version of extern.php

Why not just run the query yourself?

<?php
define('PUN_ROOT', './'); // Change to whatever
include ROOT."include/common.php";
$id = 1;
$start_from = 0;

// The query from viewtopic.php
$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

while($row = $db->fetch_assoc($result))
{
// Echo the junk
}
?>

Then you can just echo it wherever you want wink

3 (edited by AlanCollier 2006-08-21 23:35)

Re: Slimmed down version of extern.php

Thanks for the quick reply!

Before I echo the message, would I not need to run it through the parser? censored words check? etc.?
I figured that it wouldn't yet be in a publishable form..?

Cheers

--Alan

4

Re: Slimmed down version of extern.php

Alan,

See if this would work: http://punbb.org/forums/viewtopic.php?id=6586