Author |
Message |
stclem
Regular
![Regular Regular](modules/Forums/images/ranks/2stars.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Oct 18, 2008
Posts: 52
|
Posted:
Tue Dec 09, 2008 11:50 am |
|
im using original forum block, but want to change it.
1. Can someone help me to add the date for last post in a topic behind the topic tittle?
2. Is it any easy way to add number of post in a topic behind the topic tittle?
Then it be like this.
- Topic tittle (2) date
thanks
Code:if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
global $prefix, $db, $sitename;
$sql = 'SELECT t.forum_id, topic_id, topic_title, auth_view, auth_read FROM '.$prefix.'_bbtopics AS t, '.$prefix.'_bbforums AS f WHERE f.forum_id=t.forum_id ORDER BY topic_time DESC LIMIT 10';
$result = $db->sql_query($sql);
$content = '<br />';
while (list($forum_id, $topic_id, $topic_title, $auth_view, $auth_read) = $db->sql_fetchrow($result)) {
if (($auth_view < 2) OR ($auth_read < 2)) {
$content .= '<img src="images/arrow.gif" border="0" alt="" title="" width="9" height="9" /> <a href="forums.html?amp;file=viewtopic&t='.$topic_id.'">'.$topic_title.'</a><br />';
}
}
$content .= '<br /><center><a href="forums.html"><b>'.$sitename.' Forums</b></a><br /><br /></center>';
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
kguske
Site Admin
![](modules/Forums/images/avatars/41f0b40a419280935f3a0.gif)
Joined: Jun 04, 2004
Posts: 6437
|
Posted:
Wed Dec 10, 2008 12:40 pm |
|
That's an interesting idea. I will look into that for the feeds while addressing another issue, and that should help me identify what you're looking for. |
_________________ I search, therefore I exist...
Only registered users can see links on this board! Get registered or login! |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
Site Admin
![](modules/Forums/images/avatars/Dilbert/Dilbert_-_Dogbert_King.gif)
Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania
|
Posted:
Wed Dec 10, 2008 3:01 pm |
|
stclem, its easy. I will look at it when I get home tonight. |
_________________ "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. |
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
stclem
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Thu Dec 11, 2008 3:03 am |
|
yeah, easy, right
know its not a hard work, have tryed to take code from center forum block, but dont get it to work.
So for people who know this it would be not a to dificult thing Thanks. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
stclem
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Dec 14, 2008 5:17 am |
|
Palbin wrote: | stclem, its easy. I will look at it when I get home tonight. |
did you get a look at it? |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Sun Dec 14, 2008 10:23 am |
|
Been busy with the holidays coming up. I should be able to take a gander at it today. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 6:23 am |
|
OK this took a little longer and was a little more complex than I thought. I have posted the code below, but I would go to this link to get a copy of the code because the rewrite rules on this site alter the links in the code. You may want to change how everything is displayed, but this should get you well on your way.
http://www.phpnuke-clan.net/highlighted_php/block-Forum.phps
Code:
<?php
if ( !defined('BLOCK_FILE') ) {
Header('Location: ../index.php');
die();
}
global $aid, $user, $cookie, $prefix, $user_prefix, $db, $sitename, $userinfo;
// Calculate posting time offset for user defined timezones
$serverTimeZone = date("Z")/3600;
if ($serverTimeZone >= 0) $serverTimeZone = "+".$serverTimeZone;
if (is_user($user)) {
cookiedecode($user);
$uid = $cookie[0];
$name = $cookie[1];
$userinfo = getusrinfo($user);
$userTimeZone = $userinfo['user_timezone'];
$userDateFormat = $userinfo['user_dateformat'];
}
else {
$uid = 1;
$name = "$anonymous";
$sql = "SELECT v1.config_value , v2.config_value FROM ".$prefix."_bbconfig v1, ".$prefix."_bbconfig v2 WHERE v1.config_name='board_timezone' and v2.config_name='default_dateformat' ";
$result = $db->sql_query($sql);
list($userTimeZone, $userDateFormat) = $db->sql_fetchrow($result);
}
$userTimeZone = ($userTimeZone - $serverTimeZone)*3600;
if (!is_numeric($userTimeZone)) $userTimeZone = 0;
$sql = "SELECT p.poster_id, p.post_time, p.post_username, u.username, u.user_id, u.user_color_gc
FROM ".$prefix."_bbposts p, ".$user_prefix."_users u
WHERE p.post_id = '$topic_last_post_id'
AND u.user_id = p.poster_id";
$result2 = $db->sql_query($sql);
list($poster_id, $post_time, $post_username, $username, $user_id, $user_color_gc) = $db->sql_fetchrow($result2);
if( $user_id == 1 && $post_username != '' ) {
$username = $post_username;
}
$sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, f.forum_id, f.auth_view, f.auth_read FROM '.$prefix.'_bbtopics AS t, '.$prefix.'_bbforums AS f WHERE f.forum_id = t.forum_id ORDER BY t.topic_time DESC LIMIT 10';
$result = $db->sql_query($sql);
$content = '<br />';
while (list($tforum_id, $topic_id, $topic_title, $topic_time, $topic_replies, $topic_last_post_id, $forum_id, $auth_view, $auth_read) = $db->sql_fetchrow($result)) {
if (($auth_view < 2) OR ($auth_read < 2)) {
$sql2 = 'SELECT p.post_id, p.post_time FROM '.$prefix.'_bbposts AS p WHERE p.post_id = '.$topic_last_post_id.'';
$result2 = $db->sql_query($sql2);
list($post_id, $post_time) = $db->sql_fetchrow($result2);
$post_time = date($userDateFormat, ($post_time + $userTimeZone));
$content .= '<img src="images/arrow.gif" border="0" alt="" title="" width="9" height="9" /> <a href="forums.html?amp;file=viewtopic&t='.$topic_id.'">'.$topic_title.'</a> ('.$topic_replies.')<i> '.$post_time.'</i><br />';
}
}
$content .= '<br /><center><a href="forums.html"><b>'.$sitename.' Forums</b></a><br /><br /></center>';
?>
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
stclem
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 8:29 am |
|
The number behind was perfect. The date was not so good, it worked, but was to big if you understand.
It becomes like this
forum topic (1) Tue Dec 02, 2008 8:03 pm
Is it easy to get it like this
forum topic (1) ddmmyy tt:mm
if its a lot of work i really dont ned it, but if its easy please help.
PS: nead a 24 hour clock and not am/pm.
thanks. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 9:21 am |
|
It is setup to use the user defined date format from your account, but I can make it use what ever you want. I'll look at it tonight. We just need to play with this line:
Code:
$post_time = date($userDateFormat, ($post_time + $userTimeZone));
|
|
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
Palbin
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 11:33 am |
|
Try this:
Code:
$post_time = date('d-m-y H:i', ($post_time + $userTimeZone));
|
I haven't tested it, but give it a try and let me know. |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
stclem
![](modules/Forums/images/avatars/gallery/blank.gif)
|
Posted:
Mon Dec 15, 2008 12:16 pm |
|
|
|
![](themes/RavenIce/forums/images/spacer.gif) |
|