Hey , Can someone please tell me how i can take like my latest 5 or 10 topics from a specifc section, of my forum, and show them on a section on my new site layout, not forum?, and does my site have to be .html or .php?
Announcement
Collapse
No announcement yet.
How can i take latest forum topics and show them on my new Site Layout
Collapse
X
-
Originally posted by hypnoticpimpHey , Can someone please tell me how i can take like my latest 5 or 10 topics from a specifc section, of my forum, and show them on a section on my new site layout, not forum?, and does my site have to be .html or .php?
-
Comment
-
<?
$forumid = 2; // enter the forum id here
$itemstolist = 4; // enter the total number of items to list
$forumroot = "forums"; // enter the root. Let's say it's: http://wwww.disney.com/forums/, you'd enter forums. Assuming the index.php is located: http://www.disney.com/index.php
### Shouldn't have to edit below this line ###
require_once("{$forumroot}/includes/config.php");
mysql_connect($config['MasterServer']['servername'],$config['MasterServer']['username'],$config['MasterServer']['password']) or die("Cannot connect to MySQL Server");
mysql_select_db($config['Database']['dbname']) or die("Cannot find the MySQL Database");
unset($config);
$fetchrecent = mysql_query("SELECT * FROM thread WHERE forumid='{$forumid}' ORDER BY lastpost DESC LIMIT 0,{$itemstolist}");
while($fetchitem = mysql_fetch_array($fetchrecent)){
echo("<a href='{$forumroot}/showthread.php?p={$fetchitem[threadid]}'>{$fetchitem[title]}</a>");
}
?>
I just wrote this up in 5 minutes, this stuff is easy to me. If you need anything else, let me know! BTW the file cannot be index.html it must have the extension .php, furthermore you'll need to configure the variables at top. So long as you don't use php on any other part of your index.html you can simply paste this code where you want it to display.
Also please post back if this helped you, I want to know how it went.Last edited by elixeus; Sun 18 Dec '05, 10:10pm.http://www.ragnarokhq.com (Administrator)
Fansite for RagnarokOnline since 2002. Since I started I've learned a lot. I'm so vastly experienced at PHP I can pretty much code anything.
Comment
-
-
why cant it find the database! my mysql is good, and i checked my config.php page and everything is good there. i mean if my config.php wasnt correct, then my forum wouldnt have worked! correct?
Please can someone do this for me
herees where i uploaded the code
http://www.nittolive.info/latesttopics1.php
see for yourself, look at what it says
link to my forums is www.NittoLive.info/forumsLast edited by hypnoticpimp; Thu 16 Mar '06, 10:34am.
Comment
Related Topics
Collapse
-
by enCydeHow do I show Latest Topics on main like Vbulletin site have?, I can't find it
-
Channel: Support Issues & Questions
Tue 15 Oct '13, 6:28pm -
Comment