PDA

View Full Version : Help calling new threads to a custom page help


Da-Vinci
05-09-2010, 11:00 PM
On my page, I'm trying to list the top 5 threads in a table.

I'm trying to call the latest thread to position 1 in the table, the second newest thread to position 2 ect, ect, with thread replies not having an effect on how high up or down in the table a thread is placed.

I've created a template and a php file following Lynnes article so I just need to be able to call new threads to display in the table I've created on my page.

Here's an image describing what I'm attempting.

http://www.hostmypics.org/pictures/5d1684eccb9c9d7896f1e9d821c76b92.png (http://www.hostmypics.org)

I'm ok with everything except for calling the threads.

Da-Vinci
05-10-2010, 08:14 PM
***bump***

Xencored
05-10-2010, 08:19 PM
delete sorry i didnt read it all...

Lynne
05-10-2010, 08:40 PM
I think you just basically need something along these lines (replace * with the specific fields you want):
$my_query="SELECT * FROM ".$TABLE_PREFIX."thread as thread
WHERE thread.visible = 1 AND thread.forumid=x
ORDER BY thread.dateline desc limit 5";
$my_result=$db->query($my_query);

while ($my_variable=$db->fetch_array($my_result)) {
do stuff, including rending the template
}

(There are mods around that have these queries and the while loop and all, you just need to go look.)