vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Show posts instead of threads... HELP!!!!! (https://vborg.vbsupport.ru/showthread.php?t=46854)

ViPeR-GtS 12-20-2002 11:55 PM

Show posts instead of threads... HELP!!!!!
 
Code:

<?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 Code:

<?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

Code:

<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

Quote:

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:
Code:

<input type="hidden" name="s" value="">
<input type="hidden" name="action" value="postreply">

add this:
Code:

<input type="hidden" name="redirectnonvb" value="1">
then open newreply.php
find:
PHP Code:

      // 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:
PHP Code:

      // 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 ???


All times are GMT. The time now is 10:03 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01118 seconds
  • Memory Usage 1,775KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete