Previous Thread
Next Thread
Print Thread
Rate Thread
#237918 02/24/2003 11:47 AM
Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
On my indexpage i want a simple newsbox that takes the latest post i a specific forum and puts it in to my sidebar on my indexpage..

do i have to install IIP just to do this one thing ??

thomas
www.venuslogen.dk

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
There is a ubbtnews.php script included in the "addons" directory of your threads install. That should do what you need.

Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
HI josh

Found it and its working great ;O)

Found also an topthreads script, but cant get it to work ??

i get this error
Warning: Supplied argument is not a valid MySQL result resource in /www/sites/4701.dk/httpdocs/ubbthreads/mysql.inc.php on line 130

the code is looking like this

Code
 <? <br />/* <br /># UBB.threads, Version 6 <br /># Official Release Date for UBB.threads Version6: 06/05/2002 <br /> <br /># First version of UBB.threads created July 30, 1996 (by Rick Baker). <br /># This entire program is copyright Infopop Corporation, 2002. <br /># For more info on the UBB.threads and other Infopop <br /># Products/Services, visit: http://www.infopop.com <br /> <br /># Program Author: Rick Baker. <br /> <br /># You may not distribute this program in any manner, modified or otherwise, <br /># without the express, written written consent from Infopop Corporation. <br /> <br /># Note: if you modify ANY code within UBB.threads, we at Infopop Corporation <br /># cannot offer you support-- thus modify at your own peril :) <br /># --------------------------------------------------------------------------- <br />*/ <br /> <br />// ------------------------------------------------- <br />// Variables Section - Edit these to suit your needs <br /> <br />  // Path to your main.inc.php script <br />   $path = "/www/sites/4701.dk/httpdocs/ubbthreads/"; <br /> <br />  // Top threads by "views" or by "replies" <br />   $topthreads =	"replies"; <br /> <br />  // Post age threshold.  How many days old can a thread be and still make <br />  // the list <br />   $threadage =	7; <br /> <br />  // Set this variable to the total number of threads that you wish to show <br />   $totalthreads = 	3; <br /> <br />  // This varialbe will affect the way the thread is listed.  Set this to none <br />  // and it will only show the thread Subject, with a link pointing to the <br />  // item on the board.  Set it to "full" and it will show the body of the <br />  // item below the subject.  Set it to a number and it will show <br />  // that many characters of the body with the subject clickable to read the <br />  // full item. <br />   $threadbody = 	'none'; <br /> <br />  // The url to your UBB.threads installation <br />   $forumurl = 	"http://www.4701.dk/ubbthreads/"; <br /> <br />  // Include the date when the news was posted <br />   $includedate = 	"no"; <br /> <br />  // Include who it was posted by <br />   $includewho = 	"no"; <br /> <br />  // You may need to change the unshift line to the path of your UBB.threads <br />  // installation <br /> <br />// ----------------------------- <br />// End of the variables section <br />   require ("$path/main.inc.php"); <br /> <br />// ------------------- <br />// Setup the variables <br />   $html = new html; <br />   $date = $html -> get_date(); <br />   $date = $date - ($threadage * 86400); <br /> <br />   $sort; <br />   if ($topthreads == "views") { <br />      $sort = "t1.B_Counter"; <br />   } <br />   else { <br />      $sort = "t1.B_Replies"; <br />   } <br /> <br />// -------------------------- <br />// Let's grab the news items <br />   $query = " <br />    SELECT t1.B_Number,t1.B_Posted,t1.B_Last_Post,t2.B_Username,t1.B_Subject,t1.B_Body,t1.B_Main,t1.B_Replies,t1.B_Counter,t1.B_Board <br />    FROM  {$config['tbprefix']}Posts AS t1, <br />          {$config['tbprefix']}Users AS t2 <br />    WHERE t1.B_Number = t1.B_Main <br />    AND   t1.B_Last_Post > '$date' <br />    AND   t1.B_PosterId = t2.U_Number <br />    ORDER BY $sort DESC <br />    LIMIT $totalthreads <br />   "; <br />   $sth = $dbh -> do_query($query); <br /> <br />// --------------------------- <br />// echo out the starting html <br />   echo "<DL>"; <br /> <br />// ----------------------- <br />// Cycle through the posts <br />   while ( list($Number,$Posted,$Last,$Username,$Subject,$Body,$Main,$Replies,$Counter,$Keyword) = $dbh -> fetch_array($sth)) { <br /> <br />   // --------------------------------- <br />   // Set up the variables for echoing <br />      $date = $html -> convert_time($Posted); <br />      if ($threadbody == "none") { <br />         $Body = ""; <br />         $Subject = "<a href=\"$forumurl/showflat.php?Board=$Keyword&Number=$Number\">$Subject</a>"; <br />      } <br />      if (ereg("[0123456789]",$threadbody)) { <br />         $Body =substr($Body,0,$threadbody); <br />         $Body .="..."; <br />         $Subject = "<a href=\"$forumurl/showflat.php?Board=$Keyword&Number=$Number\">$Subject</a>"; <br />      } <br />      if ($includedate == "yes") { <br />         $date = "<br>Posted on $date"; <br />      } <br />      else { <br />         $date = ""; <br />      } <br />      if ($includewho == "yes") { <br />         $Username = "<br>Posted by $Username"; <br />      } <br />      else { <br />         $Username = ""; <br />      } <br /> <br />   // ------------------------------- <br />   // The actual HTML that is put out <br />      echo " <br />        <b><font face=\"Verdana\" size=\"2\" color=\"#FFffff\">Top Indlæg</font></b><br> <br />    <table><tr><td width= 100% bgcolor= #CBCDCD ><DT><font size=2><b>$Subject</b> <br />        $date <br />        $Username <br />        <DD>$Body <br />      "; <br /> <br />  // --------------- <br />  // End of the HTML <br /> <br />   } <br />   echo "</DL><td></tr></table>"; <br />   $dbh -> finish_sth($sth); 

Last edited by kordegnen; 02/25/2003 5:58 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
You might need to comment out this line:

require ("$path/main.inc.php");


As you only need to require manin.inc.php once per page.

Hope that helps.

Daine #237922 02/26/2003 7:34 AM
Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
if i do that i get this error

Fatal error: Cannot instantiate non-existent class: html in /www/sites/4701.dk/httpdocs/ubbthreads/addons/ubbttopthreads.php on line 63


thomas

Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
1) Warning: Supplied argument is not a valid MySQL result resource

That's a secondary error. It usually means that a previous MySQL query failed. Do any other errors show up in your MySQL error log?

2) Instead of removing the require, try replacing it with require_once.

Joined: Feb 2003
Posts: 1
Lurker
Lurker
Offline
Joined: Feb 2003
Posts: 1
i'm getting the same error...i tried the changes...am trying to get access to the MYSQL error log to get more info.

does anybody have this working?

thanks,
jerad


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)