Log in

View Full Version : Pull out text from post


christmas
12-10-2008, 12:08 PM
Hi guys

I like to pull out newest thread on non vbul index-page. I found this mod wich seems to work. But the mod do not include text from the posts. I like to include around 25 characters from each post. It must be relatively easy to pull out post-text, but is it? and what is the database-name of a post?

Here is the code:

bla bla bla

$thread_sql = mysql_query("SELECT threadid,title,lastpost,lastposter,post FROM thread WHERE visible=1 AND open=1 $forumid ORDER BY lastpost DESC $limited");

while($thread_get=mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$psql = mysql_query("SELECT postid FROM post WHERE threadid=$tid ORDER BY postid DESC");
$getp=mysql_fetch_array($psql);
$pid = $getp['postid'];
$date2 = date ("m/d/y h:i A" ,$lastpost);
$title = $thread_get['title'];
$title = substr($title,0,$txtlimit);
echo "<tr><td><font size=\"2\" face=\"arial,verdana,geneva\"><a href=\"$forum_url/showthread.php?p=$pid#post$pid\"><FONT SIZE=\"2\" COLOR=\"$titlecolor\" face=\"arial,verdana,geneva\">$title</FONT></a></font><br /><font color=\"$postedcolor\" face=\"arial,verdana,geneva\" size='1'>posted by $poster <i>$date2</i></FONT></td></tr>";
}
echo "</table>";

Lynne
12-10-2008, 02:10 PM
You need to grab post.pagetext from the 'post' table. So, you'll have to do a join with the 'post' table on post.postid = thread.firstpostid

christmas
12-11-2008, 07:31 AM
Hmm, I must admit I can't handle this alone. My PHP/Sql-skill are obviously to low. Can anyone help me. There are lots of mods that pulls latest posts out on nonVB index-page, but non of them pulls alsom some of the text from latest posts. It should be easy to make?! I am ready to pay for this.

Lynne
12-11-2008, 02:52 PM
If you are wanting to pay for it, let me know and I'll move this thread to paid requests. Or you can just make a post in Paid Requests yourself about this.

christmas
12-11-2008, 06:26 PM
Thanks, I will try making a request in paid section :)