View Full Version : Show posts instead of threads... HELP!!!!!
ViPeR-GtS
12-20-2002, 11:55 PM
<?php
error_reporting(7);
require('./global.php');
$news = $DB_site->query("SELECT thread.title, thread.threadid, thread.iconid, thread.postusername, thread.replycount FROM thread WHERE thread.forumid = XX ORDER BY thread.threadid DESC LIMIT 5");
print("<table width='95%' align='center' cellspacing=0>");
$lastdate="";
while($new=$DB_site->fetch_array($news)) {
$newstext=$DB_site->query_first("
SELECT post.pagetext, post.dateline FROM post
WHERE post.threadid='$new[threadid]'
ORDER BY postid LIMIT 5
");
print("<tr>");
//if(date("d.m.Y",$newstext[dateline])!=$lastdate) {
//print(date("d.m.Y",$newstext[dateline])); }
$lastdate=date("d.m.Y",$newstext[dateline]);
print("<th class='head' align='left' bgcolor='#FFFFFF".$headcolor."'><font size=1>".date("d.m.Y - H:i:",$newstext[dateline])."</font><br>".$new[title]."</th>");
print("<th class='head' align='right' bgcolor='#FFFFFF".$headcolor."'>".$new[postusername]."<br><font size=1><a href='http://some forums/showthread.php?s=&threadid=".$new[threadid]."'>Comments(".$new[replycount].")</a></font></th></tr>");
print("<tr></tr><tr><td class=news colspan='2' bgcolor='#FFFFFF".$newscolor."'>".bbcodeparse2($newstext[pagetext],1,1,1,1)."</td>");
print("</tr><tr><td height=5></td></tr>");
}
print("</table>");
?>
how to change the above script to show posts in one of the threads instead of threads in the forums ??
Xenon
12-21-2002, 12:05 AM
nice script, it's one of mine, where did you get it from?
the answer:
<?php
error_reporting(7);
require('./global.php');
$news = $DB_site->query("SELECT post.title, post.pagetext,post.postusername,post.dateline FROM post WHERE post.threadid = XX ORDER BY post.postid DESC LIMIT 5");
print("<table width='95%' align='center' cellspacing=0>");
$lastdate="";
while($newstext=$DB_site->fetch_array($news)) {
print("<tr>");
//if(date("d.m.Y",$newstext[dateline])!=$lastdate) {
//print(date("d.m.Y",$newstext[dateline])); }
$lastdate=date("d.m.Y",$newstext[dateline]);
print("<th class='head' align='left' bgcolor='#FFFFFF".$headcolor."'><font size=1>".date("d.m.Y - H:i:",$newstext[dateline])."</font><br>".$newstext[title]."</th>");
print("<th class='head' align='right' bgcolor='#FFFFFF".$headcolor."'>".$newstext[postusername]."<br><font size=1><a href='http://forums.khabal.com/showthread.php?s=&threadid=".$new[threadid]."'>Comments(".$new[replycount].")</a></font></th></tr>");
print("<tr></tr><tr><td class=news colspan='2' bgcolor='#FFFFFF".$newscolor."'>".bbcodeparse2($newstext[pagetext],1,1,1,1)."</td>");
print("</tr><tr><td height=5></td></tr>");
}
print("</table>");
?>
ViPeR-GtS
12-21-2002, 12:21 AM
in one of the post here... anyway you got any idea how to make it show posts instead of threads ???
Xenon
12-21-2002, 12:24 AM
never posted it here :)
just gave it away to one or two, but no problem, i was just faszinated to see it here ;)
well, use the code i posted above, it should work for posts instead :)
ViPeR-GtS
12-23-2002, 03:34 AM
<form enctype="multipart/form-data" action="http://some forums/newreply.php" name="vbform" method="post">
<input type="hidden" name="s" value="">
<input type="hidden" name="action" value="postreply">
<input type="hidden" name="threadid" value="xxxxx">
<input type="hidden" name="title" value="">
<input type="hidden" name="iconid" value="0">
<input type="hidden" name="parseurl" value="yes">
<input type="hidden" name="email" value="">
<input type="hidden" name="disablesmilies" value="">
<input type="hidden" name="signature" value="yes">
<input type="hidden" name="closethread" value="">
<input type="hidden" name="hiddenreply" value="">
<input type="hidden" name="signature" value="yes">
<input type="hidden" name="rating" value="0">
<table cellpadding="0" cellspacing="0" border="0" bgcolor="#555576" width="100%" align="center"><tr><td>
<table cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td bgcolor="#8080A6" colspan="2"><font face="verdana, arial, helvetica" size="2" color="#EEEEFF" class="thtcolor"><b>Post
Reply</b></font></td>
</tr>
<tr valign="top">
<td bgcolor="#DFDFDF"><font face="verdana, arial, helvetica" size="2" ><b>Your User Name:</b></font></td>
<td bgcolor="#DFDFDF"><font face="verdana, arial, helvetica" size="2" ><input type="text" class="bginput" name="username" value="INPUT NAME" size="25">
</font>
<font face="verdana,arial,helvetica" size="1" ><a href="register.php?action=signup">Want to register?</a>
</font></td>
</tr>
<tr valign="top">
<td bgcolor="#F1F1F1"><font face="verdana, arial, helvetica" size="2" ><b>Your Password:</b></font></td>
<td bgcolor="#F1F1F1"><font face="verdana, arial, helvetica" size="2" ><input type="password" class="bginput" name="password" value="" size="25">
</font>
<font face="verdana,arial,helvetica" size="1" ><a href="member.php?action=lostpw">Forgotten your password?</a>
</font></td>
</tr>
<tr>
<td bgcolor="#DFDFDF" valign="top" nowrap><font face="verdana, arial, helvetica" size="2" ><b>Your
Reply:</b></font></td>
<td bgcolor="#DFDFDF">
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td>
<textarea name="message" rows="7" cols="70" wrap="virtual" tabindex="1"></textarea>
<br>
<font face="verdana,arial,helvetica" size="1" ></font></td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr></table>
<br>
<table cellpadding="2" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td align="center"><font face="verdana, arial, helvetica" size="2" >
<input type="submit" class="bginput" name="submit" value="Submit Reply" accesskey="s" tabindex="2">
</font></td>
</tr>
</table>
</form>
if i use this on a non-vb page, how to i let it redirect back to this non vb page after someone has posted ???
DrkFusion
12-23-2002, 01:24 PM
Xenon, what does this exactly do?
Xenon
12-23-2002, 02:02 PM
@viper: please use code tags whenever you post code lines, it's so hard to read without....
well, you have to hack newreply.php and change the redirect-code whenever it's called by this non vb-script...
@Drk: It's the newsscript i use on my site, just a few lines i coded long time ago, because my mainpage is on a different server than the board, so i can't use a normal portal :)
ViPeR-GtS
12-23-2002, 10:59 PM
Originally posted by Xenon
@viper: please use code tags whenever you post code lines, it's so hard to read without....
well, you have to hack newreply.php and change the redirect-code whenever it's called by this non vb-script...
sorry will do tat next time :)
btw im not quite used to the vb codes, hope u can enlighten me regarding the changing of codes for redirect. Thanks :)
Xenon
12-23-2002, 11:55 PM
hmm, in your non vb-script after that:<input type="hidden" name="s" value="">
<input type="hidden" name="action" value="postreply">
add this:
<input type="hidden" name="redirectnonvb" value="1">
then open newreply.php
find: // redirect
if ($visible) {
$goto="showthread.php?s=$session[sessionhash]&postid=$postid#post$postid";
} else {
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
}
eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");
and change to this:
// redirect
if ($visible) {
$goto="showthread.php?s=$session[sessionhash]&postid=$postid#post$postid";
} else if($redirectnonvb!=1) {
$goto="forumdisplay.php?s=$session[sessionhash]&forumid=$threadinfo[forumid]";
} else {
$goto="url where to redirect :)";
}
eval("standardredirect(\"".gettemplate("redirect_postthanks")."\",\"$goto\");");
ViPeR-GtS
12-24-2002, 12:20 AM
Thanks... Xenon
another question...
the 1st code i post here... is to show the last 5 post rite...
if i want to make it to show all, how to make like show 5 or 10 per page ???
Xenon
12-24-2002, 10:07 AM
perpage viewings isn't that easy, but possible, too
just play around with the limit tag of mysql :)
DrkFusion
12-25-2002, 01:26 AM
Wow, this looks very useful in my case. Would I be able to receive the code...unless that is that above :)
If it is, may I have permission to use it?
Xenon
12-25-2002, 09:18 PM
Arunan, of course you can get it and use it.
but it's just a little newsgrapper to get the news out of the db, not very special, and i think it wasn't coded perfectly, it just fits my needs for my site ;)
but if you want it, ask per pm again so i cant forget ;)
ViPeR-GtS
02-04-2003, 04:53 AM
Xenon: some question to ask...
how to auto logout after you have post a reply and redirect back to the non vb page ???
and the login cant seems to work... does it need to be in the same folder as the forums files ???
Xenon
02-04-2003, 04:08 PM
the autologout is after 15 minutes...
that's why cookietimeout is there.
for redirect just change the redirect link.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.