PDA

View Full Version : {Request} Newest Threads


Automated
10-21-2002, 02:16 PM
Hi All!

I have searched High and low, and cannot find a hack/mod that will let me show the 10 newest threads on my forums on another website!

What i mean is, I have a forum and a content site that is related to the forum, and want to have a table at the bottom of the page that shows the 10 newest threads, its author and the number of replies.

I have seen a load of these in use on other website and cannot find the dam thing!

Please point me in the right direction! Thanks a lot!

Matthew

Neo
10-21-2002, 02:45 PM
<a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=44719" target="_blank">https://vborg.vbsupport.ru/showt...threadid=44719</a>

Automated
10-21-2002, 02:53 PM
thats not what i mean, have a look at the bottom of the page at sitepoint.com thats what i want! :p

Thanks
Matthew

FlyingDutchman
10-21-2002, 04:22 PM
you might wanna check this out:

https://vborg.vbsupport.ru/showthread.php?threadid=38334

you could 'rip' the not-needed code out...
or you could rip the code from one of those other 'home' pages, like vbportal, vbindex, vbhome, etc.

Automated
10-21-2002, 04:34 PM
:( I am not a programmer, and i have VERY basic VBulletin skillls as i only got the license 3 days ago ;)

Could anyone help me out?

thanks
Matthew

FlyingDutchman
10-22-2002, 09:05 AM
o, sorry ;) didn't know...
well, i can do this lil' flick for you if you can tell me where you actually want it... on your forum home page, or your website homepage? (i assume it's the last one)
if it's your website homepage, what language is it written in? php? plain html? something else?

please tell me ;)

Automated
10-22-2002, 09:09 AM
Thanks a lot man!

it is written in PHP!

And it is on another server my forums http://freelanceforums.com and the site i want it on is http://howtofreelance.com (not yet built) so i dont know if this effects anything :(

the page is in PHP so if you could make the page that i just need to add my DB details to that would be great ! Thanks a lot!

Matthew

FlyingDutchman
10-22-2002, 10:23 AM
ok, this might work (i haven't tested... and b/c of your forums are on another server/domain, i'm not sure if it actually works...)
i also removed the permissions code that was included in the original, this might not be so secure, but if you don't do strange things, it should be ok (supposing your forums are viewable by guests...)

open your php file, just after <? add:


// Simple Newsportal & Threads overview hack
// Copyright by KuraFire, 2002 :)
// With extra credit to PPN for the permissions section

$templatesused = 'newsportal,newsportal_threadbit,newsportal_newsbi t';
include('http://url-to-your-forums/forums/global.php');

// These are the variables which define the news forum and the
// limit of threads.
$newsforum = 5;
$threadslimit = 10;


(Remember to change the url: ''http://url-to-your-forums/forums/" to the right url and set the variables...)


then, where you want the 10 (or more or less if you want, see the variables) latest threads/replies list to show up, put this in the php file:

/* ### THREADS SECTION ### */

$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE open='1' AND open<>10 $forumperms ORDER BY lastpost DESC LIMIT

$threadslimit");

if (!$threadsql) {
// use this only to check whether it works on your board,
// after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
echo "<p>Could not get thread records.";
exit;
}

while ($thread=$DB_site->fetch_array($threadsql)) {
$lastposter=$thread['lastposter'];
$threadid=$thread['threadid'];
$title=$thread['title'];
$replycount=$thread['replycount'];

$fulltitle = $title;
if (strlen($title) > 50) {
$title = substr($title, 0, 50);
$title .= '...';
}

eval("\$threadbits .= \"".gettemplate('newsportal_threadbit')."\";");
}



finally log in to the admin panel of your forums and make a new template called 'newsportal_threadbit' with the following contents:

<tr bgcolor="#F1F1F1">
<td bgcolor="#F1F1F1" width="7" align="center" valign="top"><smallfont>&raquo;</smallfont></td>
<td onMouseOver="style.backgroundColor='#8080A6'; style.cursor='hand'" onMouseOut="style.backgroundColor='#F1F1F1';" onClick="location.href='showthread.php?s=&threadid=$threadid&goto=lastpost'">&nbsp;<a href="showthread.php?s=&threadid=$threadid&goto=lastpost">$title</a> <smallfont color="#FFFFFF">[$replycount]-[$lastposter]</smallfont></td>
</tr>



REMEMBER THAT I DID NO CODING ON THIS ONE, EVERYTHING IS CODED BY KuraFire, AND THEREFORE ALL CREDITS ABOUT THE CODE SHOULD GO TO HIM!!!

Automated
10-22-2002, 10:46 AM
Thanks A LOT for that!

I will test it now ;)

[hides the excitement :D ]

Matthew

FlyingDutchman
10-22-2002, 10:55 AM
lol, tell me if it works ;)

Automated
10-22-2002, 12:29 PM
I get an error :(

Fatal error: Call to a member function on a non-object in /home/howto/public_html/index1.php on line 21

Automated
10-22-2002, 12:31 PM
I added the template to the forum admin, Fine!

Then created a page called index1.php and just added the following code nothing else then uploaded it!

Have i missed something fundamental out? <?

// Simple Newsportal & Threads overview hack
// Copyright by KuraFire, 2002 <img src="https://vborg.vbsupport.ru/images/newsm/happy.gif" border="0" alt="">
// With extra credit to PPN for the permissions section

$templatesused = 'newsportal,newsportal_threadbit,newsportal_newsbi t';
include('http://freelanceforums.com/global.php');

// These are the variables which define the news forum and the
// limit of threads.
$newsforum = 5;
$threadslimit = 10;





/* ### THREADS SECTION ### */

$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE open='1' AND open<>10 $forumperms ORDER BY lastpost DESC LIMIT

$threadslimit");

if (!$threadsql) {
// use this only to check whether it works on your board,
// after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
echo "<p>Could not get thread records.";
exit;
}

while ($thread=$DB_site->fetch_array($threadsql)) {
$lastposter=$thread['lastposter'];
$threadid=$thread['threadid'];
$title=$thread['title'];
$replycount=$thread['replycount'];

$fulltitle = $title;
if (strlen($title) > 50) {
$title = substr($title, 0, 50);
$title .= '...';
}

eval("\$threadbits .= \"".gettemplate('newsportal_threadbit')."\";");
}


?>


Thanks a lot for your help :D

Matthew

FlyingDutchman
10-22-2002, 01:47 PM
what do you mean? it doesn't work?
if it doesn't work it might be due to the fact that the forums are on another server/domain...

Automated
10-22-2002, 01:53 PM
i'll try that on my forum server then!

then get back to you!

Automated
10-22-2002, 01:56 PM
nope :(

Same error message

Fatal error: Call to a member function on a non-object in /home/freelanc/public_html/index1.php on line 21

http://freelanceforums.com/index1.php

Chris M
10-22-2002, 02:32 PM
A couple of suggestions :

1) Uploaded it in the wrong mode - If uploaded in ASCII, try Binary;)

2) Try this code instead :
<?php

// Simple Newsportal & Threads overview hack
// Copyright by KuraFire, 2002 <img src="https://vborg.vbsupport.ru/images/newsm/happy.gif" border="0" alt="">
// With extra credit to PPN for the permissions section

$templatesused = 'newsportal,newsportal_threadbit,newsportal_newsbi t';
include('http://freelanceforums.com/global.php');

// These are the variables which define the news forum and the
// limit of threads.
$newsforum = 5;
$threadslimit = 10;

//* ### THREADS SECTION ### *//

$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE open='1' AND open<>10 $forumperms ORDER BY lastpost DESC LIMIT $threadslimit");

if (!$threadsql) {
// use this only to check whether it works on your board,
// after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
echo "<p>Could not get thread records.";
exit;
}

while ($thread=$DB_site->fetch_array($threadsql)) {
$lastposter=$thread['lastposter'];
$threadid=$thread['threadid'];
$title=$thread['title'];
$replycount=$thread['replycount'];

$fulltitle = $title;
if (strlen($title) > 50) {
$title = substr($title, 0, 50);
$title .= '...';
}

eval("\$threadbits .= \"".gettemplate('newsportal_threadbit')."\";");
}


?>

Satan

Automated
10-22-2002, 02:42 PM
trying it now

Automated
10-22-2002, 02:43 PM
nope :( I have uploaded in binary and ASCII and still nothing!

I have seen this work on sites like sitepoint.com (look at bottom of page)

Matthew

FlyingDutchman
10-22-2002, 04:06 PM
eww, bad thing to hear that it's not working...
anyway, do you mind if I try to find the problem tomorrow?
it's getting late... and my mind is totally f*ck*d up atm :)

Automated
10-22-2002, 04:18 PM
NO problemo!

You are helping me out here! Do it when you are on the toilet if it makes you happy!

Thanks M8

Matthew

FlyingDutchman
10-24-2002, 04:19 AM
i just cannot seem to find out what's wrong with the code really :(
sorry...

did you already contact the webmaster of sitepoint.com?
maybe he can give you the code...

FlyingDutchman
10-24-2002, 04:22 AM
oh, i might have found the problem, here try this instead:

<?php

// Simple Newsportal & Threads overview hack
// Copyright by KuraFire, 2002 <img src="https://vborg.vbsupport.ru/images/newsm/happy.gif" border="0" alt="">
// With extra credit to PPN for the permissions section

$templatesused = 'newsportal,newsportal_threadbit,newsportal_newsbi t';
include('http://freelanceforums.com/global.php');

// These are the variables which define the news forum and the
// limit of threads.
$newsforum = 5;
$threadslimit = 10;

//* ### THREADS SECTION ### *//

$threadsql = $DB_site->query("SELECT lastposter, threadid, title, replycount FROM thread WHERE open='1' AND open<>10 ORDER BY lastpost DESC LIMIT $threadslimit");

if (!$threadsql) {
// use this only to check whether it works on your board,
// after all tests turn successful you can remove it if you want (remove entire IF-statement of course)
echo "<p>Could not get thread records.";
exit;
}

while ($thread=$DB_site->fetch_array($threadsql)) {
$lastposter=$thread['lastposter'];
$threadid=$thread['threadid'];
$title=$thread['title'];
$replycount=$thread['replycount'];

$fulltitle = $title;
if (strlen($title) > 50) {
$title = substr($title, 0, 50);
$title .= '...';
}

eval("dooutput(\"".gettemplate('newsportal_threadbit')."\");");
}


?>

FlyingDutchman
10-24-2002, 04:29 AM
oh, btw, you mustn't have the open_basedir restriction enabled, otherwise it can't load the global.php file from the other server/domain...

FlyingDutchman
10-24-2002, 04:47 AM
this code doesn't work too!

it might be the query, but i can't find the problem in that thing :(

Automated
10-24-2002, 02:45 PM
i think what i will do is just generate the page on the forum server and the iFrame it into the other site (or something similar)

Thanks for the help though, i will contact the webmaster of SP now, although i dont think they will want to help :(

Matthew