Home
>
Outdated forums
>
Phorum 3 forums (READ ONLY)
>
Finished Mods and Plug-ins (READ ONLY)
>
Topic
Hack that displayes x last postes from x forums
Posted by Sonny
Hack that displayes x last postes from x forums January 03, 2002 12:56PM |
Registered: 23 years ago Posts: 11 |
Hi!
We are a coupel that just has made a hack that displayes x number of latest post from a forum folder
tha hack is testet in ver. 3.3.1a
in phorum you can create "new folder" where you can place forums inside....
IT IS THE FOLDER ID YOU SHOUD USE to get this hack to work!
ant then it takes a look al ALL the forums that are "asigned" to the folder and displays the number you want!
Here are the hack :
<?
// This hack is made for phrum.org forums ver. 3.3.1a and will finde x numbers of posts from forum.
// Syntax: get_new_posts.php?parent=1&number=5
// Gets the 5 newest posts from forum FOLDER 1.
// wision & Testet by cyberdude.
// Made by The_NESt.
$parent=1; // Here you write the FOLDER id number
$number=5; // here you write the number of postes that you want to display
chdir("phorum/"); // the place where phorum is "instaled"
include "common.php";
$SQL="select id, table_name from forums where parent='$parent'";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)) {
$tables[] = $rec["table_name"];
$forumids[$rec["table_name"]] = $rec["id"];
$rec=$q->getrow();
}
while(list($key, $table) = each($tables)) {
$SQL="select id, thread, author, subject, datestamp from $table order by datestamp desc limit $number";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)) {
$posts[$rec["datestamp"]][] = $rec;
$loop = 0;
while($posts[$rec["datestamp"]][$loop] != $rec) {
$loop++;
}
$posts[$rec["datestamp"]][$loop]["forumid"] = $forumids[$table];
$rec=$q->getrow();
}
}
ksort($posts);
$posts = array_reverse($posts);
$loop = 0;
while($loop <= (sizeof($posts) - 1) && $loop <= ($number - 1) && list($key, $date) = each($posts)){
while($loop <= ($number - 1) && list($key, $rec) = each($date)) {
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\"> $rec[subject] </a> - $rec[author] - $rec[datestamp]<br>\n";
$loop++;
}
}
?>
HINT if you want to use this hack in an other place
you can use
<?
include("[server.com];);
?>
But remember to outcoment this lines in the hack
$parent=1; // Here you write the FOLDER id number
$number=5; // here you write the number of postes that you want to
Hope you enjoye this hack!
We are a coupel that just has made a hack that displayes x number of latest post from a forum folder
tha hack is testet in ver. 3.3.1a
in phorum you can create "new folder" where you can place forums inside....
IT IS THE FOLDER ID YOU SHOUD USE to get this hack to work!
ant then it takes a look al ALL the forums that are "asigned" to the folder and displays the number you want!
Here are the hack :
<?
// This hack is made for phrum.org forums ver. 3.3.1a and will finde x numbers of posts from forum.
// Syntax: get_new_posts.php?parent=1&number=5
// Gets the 5 newest posts from forum FOLDER 1.
// wision & Testet by cyberdude.
// Made by The_NESt.
$parent=1; // Here you write the FOLDER id number
$number=5; // here you write the number of postes that you want to display
chdir("phorum/"); // the place where phorum is "instaled"
include "common.php";
$SQL="select id, table_name from forums where parent='$parent'";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)) {
$tables[] = $rec["table_name"];
$forumids[$rec["table_name"]] = $rec["id"];
$rec=$q->getrow();
}
while(list($key, $table) = each($tables)) {
$SQL="select id, thread, author, subject, datestamp from $table order by datestamp desc limit $number";
$q->query($DB, $SQL);
$rec=$q->getrow();
while(is_array($rec)) {
$posts[$rec["datestamp"]][] = $rec;
$loop = 0;
while($posts[$rec["datestamp"]][$loop] != $rec) {
$loop++;
}
$posts[$rec["datestamp"]][$loop]["forumid"] = $forumids[$table];
$rec=$q->getrow();
}
}
ksort($posts);
$posts = array_reverse($posts);
$loop = 0;
while($loop <= (sizeof($posts) - 1) && $loop <= ($number - 1) && list($key, $date) = each($posts)){
while($loop <= ($number - 1) && list($key, $rec) = each($date)) {
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\"> $rec[subject] </a> - $rec[author] - $rec[datestamp]<br>\n";
$loop++;
}
}
?>
HINT if you want to use this hack in an other place
you can use
<?
include("[server.com];);
?>
But remember to outcoment this lines in the hack
$parent=1; // Here you write the FOLDER id number
$number=5; // here you write the number of postes that you want to
Hope you enjoye this hack!
Re: Hack that displayes x last postes from x forums January 03, 2002 05:33PM |
Registered: 23 years ago Posts: 11 |
Re: Hack that displayes x last postes from x forums January 05, 2002 08:41AM |
Re: Hack that displayes x last postes from x forums January 05, 2002 09:08AM |
Registered: 23 years ago Posts: 11 |
Hi!!
It is WERRY IMPORTENT that the $parent number is set to a FOLDER id..... if it is set to a spwcific forum it wont work!
And remember to change the select from ...... in the first query to what your main forum table is called.
if you are sure it parent is set to a FOLDER id and it wont wort then send me your file and dump of the database witch contain the main table for the forum (in most cases called forums)
It is WERRY IMPORTENT that the $parent number is set to a FOLDER id..... if it is set to a spwcific forum it wont work!
And remember to change the select from ...... in the first query to what your main forum table is called.
if you are sure it parent is set to a FOLDER id and it wont wort then send me your file and dump of the database witch contain the main table for the forum (in most cases called forums)
Re: Hack that displayes x last postes from x forums January 06, 2002 05:24AM |
Re: Hack that displayes x last postes from x forums January 07, 2002 05:02AM |
Re: Hack that displayes x last postes from x forums January 07, 2002 09:56AM |
Registered: 23 years ago Posts: 11 |
Is there somwhere i can see your forum in action, it woud make it a bit more easy for me to say what you shoud put in where... :-)
You can write to my e-mail adress if you dont want to post your site adress in here!
gonzzo@writeme.com
You can write to my e-mail adress if you dont want to post your site adress in here!
gonzzo@writeme.com
Re: Hack that displayes x last postes from x forums January 07, 2002 01:40PM |
>Is there somwhere i can see your forum in action, it woud make it a bit >more easy for me to say what you shoud put in where... :-)
>
>
>You can write to my e-mail adress if you dont want to post your site >adress in here!
>gonzzo@writeme.com
>
>Regards
>// Cyberdude
I read your message and I sent you an e-mail :)
>
>
>You can write to my e-mail adress if you dont want to post your site >adress in here!
>gonzzo@writeme.com
>
>Regards
>// Cyberdude
I read your message and I sent you an e-mail :)
Re: Hack that displayes x last postes from x forums January 08, 2002 07:44AM |
Registered: 23 years ago Posts: 11 |
Re: Hack that displayes x last postes from x forums January 08, 2002 10:02AM |
Re: Hack that displayes x last postes from x forums February 06, 2002 01:48PM |
I am trying to adapt this for another situation and I am having trouble understanding the logic of the last pair of while loops.
I dont quite follow why there are two whiles and why
inside the inner while the variable $rec is used, but the loop is on $posts and the $rec was last set inside the previous set of whiles.
Thanks Martin West
I dont quite follow why there are two whiles and why
inside the inner while the variable $rec is used, but the loop is on $posts and the $rec was last set inside the previous set of whiles.
Thanks Martin West
Re: Hack that displayes x last postes from x forums April 03, 2002 02:56PM |
I'm also getting the same errors The-King got. I'm slightly modifying your code so that it will work in PostNuke, but that should not matter to the functionality...
Here is the link to my testsite: [www.savage.no]
Hope you could help :)
Here is the link to my testsite: [www.savage.no]
Hope you could help :)
Re: Hack that displayes x last postes from x forums April 13, 2002 08:33AM |
Re: Hack that displayes x last postes from x forums April 13, 2002 09:18AM |
Registered: 23 years ago Posts: 11 |
hi Fred!!
You can see it in action on [www.bryllup.dk]
at the front page are the last 5 postes from the 9 forums that are active on the site!
The site are in danish... i don't know if anny other is using it in an other languige!
You can see it in action on [www.bryllup.dk]
at the front page are the last 5 postes from the 9 forums that are active on the site!
The site are in danish... i don't know if anny other is using it in an other languige!
But how to display the latest x threads? April 23, 2002 11:19PM |
Re: Hack that displayes x last postes from x forums May 24, 2002 07:47PM |
Hack that displayes x last ... => works, somehow ..., but, ... June 10, 2002 06:07AM |
This hack seems to work, but it shows all posts, even if I use
$limit = 1; # default max number of threads to list
You can see what I mean here: [www.deutsch-online.com]
Do you know whats wrong in this case?
Maybe the problem is that I dont understand the first lines of the script:
<?
# required phorum mode: add to list.php
# 'elseif (isset($limit)) {
# $limit=" limit $limit";'
# right before '$limit=" limit $ForumDisplay"'
Of course I want in include the last posts into another *.php-document, how van that be done?
Probably the solution to my problems is hidden in those 4 lines, but absolute beginners like me often get into troubles like this ...
Can anyone help me, please?
$limit = 1; # default max number of threads to list
You can see what I mean here: [www.deutsch-online.com]
Do you know whats wrong in this case?
Maybe the problem is that I dont understand the first lines of the script:
<?
# required phorum mode: add to list.php
# 'elseif (isset($limit)) {
# $limit=" limit $limit";'
# right before '$limit=" limit $ForumDisplay"'
Of course I want in include the last posts into another *.php-document, how van that be done?
Probably the solution to my problems is hidden in those 4 lines, but absolute beginners like me often get into troubles like this ...
Can anyone help me, please?
Re: Hack that displayes x last postes from x forums August 20, 2003 07:54AM |
Thanks, that works. All I did was to change
$parent=1;
to
$parent=0;
I also added something to make it show the German Date, which is
19.08.2003 14:00:00
instead of
2003-08-19 14:00:00
Replace
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\">
with
$_neu_datestamp = eregi_replace ("([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})" ,"\\3.\\2.\\1 \\4:\\5:\\6",$rec[datestamp]);
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\">$rec[subject]</a> von: $rec[author], geschrieben am $_neu_datestamp<br>\n";
$parent=1;
to
$parent=0;
I also added something to make it show the German Date, which is
19.08.2003 14:00:00
instead of
2003-08-19 14:00:00
Replace
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\">
with
$_neu_datestamp = eregi_replace ("([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})" ,"\\3.\\2.\\1 \\4:\\5:\\6",$rec[datestamp]);
echo "<a href=\"$forum_url/$read_page.$ext?f=$rec[forumid]&i=$rec[id]&t=$rec[thread]\">$rec[subject]</a> von: $rec[author], geschrieben am $_neu_datestamp<br>\n";
Sorry, you do not have permission to post/reply in this forum.