PLA Forums
Other Stuff That Has Little To Do With PLA => Techinical Shit => Technical Support => Topic started by: silentfreak on August 28, 2006, 11:46:11 PM
-
I'm trying to integrate my forum throughout my site. Is it possible to display the latest topics based on when they are first posted?
Once a reply has been sent through a topic will jump to the top of the list! I do not want that to happen. Here's my code.
<?php
$exclude = array('1','2','3','4','5','7','8','9','10');
$topics = ssi_recentTopics(10, $exclude, 'array');
foreach($topics as $topic)
echo $topic['link'], </br>';
?>
I do not know what I'm doing wrong. I even tried the ssi_topTopicsViews function.
-
I'm trying to integrate my forum throughout my site. Is it possible to display the latest topics based on when they are first posted?
Once a reply has been sent through a topic will jump to the top of the list! I do not want that to happen. Here's my code.
<?php
$exclude = array('1','2','3','4','5','7','8','9','10');
$topics = ssi_recentTopics(10, $exclude, 'array');
foreach($topics as $topic)
echo $topic['link'], </br>';
?>
I do not know what I'm doing wrong. I even tried the ssi_topTopicsViews function.
Don't use that code unless you just want topics to be listed over and over again when replies mount. You need to use mysql_query() or mysql_fetch_array() to look at the topics board and extrapolate the information from the timestamp of the post.
Just an FYI going forward regarding your code.....
Find:
echo $topic['link'], </br>';
Change to:
echo $topic['link'], '<br />';
---> XHTML
-
Ok, cool. I know how to add mysql_query() but I don't know how to write the actual query for what I want to do. Can you show me how?
-
1) What is the name your database prefix?
2) How many topics do you want displayed on your page?
-
1) What is the name your database prefix?
2) How many topics do you want displayed on your page?
1) smf_
2) 10
-
Use the code below and add it to your PHP. This query will return the topic title and time. It will get the last 10 created topics whether there have been replies or not.
SELECT t.ID_TOPIC, t.ID_BOARD, t.isSticky, t.locked,
m.subject, m.posterName, m.posterTime
FROM smf_topics AS t
INNER JOIN smf_messages AS m
ON t.ID_FIRST_MSG = m.ID_MSG
ORDER BY m.posterTime ASC
LIMIT 0, 10
-
Use the code below and add it to your PHP. This query will return the topic title and time. It will get the last 10 created topics whether there have been replies or not.
SELECT t.ID_TOPIC, t.ID_BOARD, t.isSticky, t.locked,
m.subject, m.posterName, m.posterTime
FROM smf_topics AS t elitehaxortothemaxor
INNER JOIN smf_messages AS m
ON t.ID_FIRST_MSG = m.ID_MSG
ORDER BY m.posterTime ASC
LIMIT 0, 10,60
as you can tell ive made some edits, you should be fine now
-
Too cute. :P
-
Too cute. :P
im never too cute, i am the ultimate bonesaw