Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Solved: 9 Years, 1 Month ago Display posts on homepage?
#1
Solved: 9 Years, 1 Month ago
Is there any way to pull threads and articles from a specific forum to a static homepage? Like the one is SMF (ssi.php)..
#2
Solved: 9 Years, 1 Month ago
You can use portal.php to pull threads from specified forums.
#3
Solved: 9 Years, 1 Month ago
Ummmm yea. I want to pull posts like in portal.php but in altogether different page that i have made. It's like a custom homepage that sits entirely out of the forum software. If there's a way to use queries to pull from portal.php, please enlighten me.
#4
Solved: 9 Years, 1 Month ago
simple method :
<?php
define("IN_MYBB", 1);
require_once("./global.php"); // Change this if needed
$tlimit = 20; // How many titles you want

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $tlimit");
while($fetch = $db->fetch_array($query)){
echo '<a href="./showthread.php?tid='.$fetch['tid'].'">'.$fetch['subject'].'</a><br />' . "\n";
}
?>
#5
Solved: 9 Years, 1 Month ago
Better to use
get_thread_link($fetch['tid'])
instead
./showthread.php?tid='.$fetch['tid'].'
This'll work in both cases, either SEF or SEO pattern URLs.
#6
Solved: 9 Years, 1 Month ago
^ oh! Thank You Smile
#7
Solved: 9 Years, 1 Month ago
Thanks all Smile . But this will show list of topics, right? How would I go about displaying the post contents? Just the initial post, not the replies.
#8
Solved: 9 Years, 1 Month ago
(2011-12-18, 02:06 PM)milliriba Wrote: Thanks all Smile . But this will show list of topics, right? How would I go about displaying the post contents? Just the initial post, not the replies.

Replace all the above code with this;
<?php
define("IN_MYBB", 1);
require_once("./global.php"); // Change this if needed
$tlimit = 20; // How many threads you want

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY `tid` DESC LIMIT $tlimit");
while($fetch = $db->fetch_array($query))
{
	$post = get_post($fetch['firstpost']);
	$thread_link = get_thread_link($fetch['tid']);
	echo '<a href="'.$thread_link.'">'.$fetch['subject'].'</a><br />'.$post['message'].'<br/>';
}
?>
#9
Solved: 9 Years, 1 Month ago
Thanks a lot Yaldaram. So it seems MyBB relies on RAW codes to get stuff done. Any documentation/tutorials for this?
#10
Solved: 9 Years, 1 Month ago
(2011-12-18, 03:02 PM)milliriba Wrote: So it seems MyBB relies on RAW codes to get stuff done.

Not at all, you can do this either through plugin or with core file editing. You do not even want to "echo" the code, you may use variables and then call them in the template.


Forum Jump:


Users browsing this thread: 1 Guest(s)