View next topic
View previous topic
Post new topic   Reply to topic
Author Message
warren-the-ape




Joined: May 18, 2008
Posts: 12

PostPosted: Wed May 28, 2008 9:16 am
Reply with quote

Ey Gotcha,

Found your site through nukeseo.com and ravenphpscripts.com and I must say you offer some amazing Nuke add-ons in here Wink
I also see Guardian here, mannn that guy is everywhere, or is he a robot? Cool

Anyway, I found your Forum Scrolling block and took it as basis for a block to display the posts from a specific forum. Had some help from this link as well;
http://nukecoder.com/ftopict-443-Forum_Scroller_Question.html

I use one of my forums for articles & interviews and wanted to display them on my homepage as well.
The only thing i cant get to work is;

I want to display the topic starter and his time of posting under the topictitle instead of the person who replied last, i tried to play around with $topic_poster and t.topic_poster but cant get it to work. I do want to sort the topics on last reply though.

Hopefully you understand my question Razz


P.s. I will post a finished version of it soon.
 
View user's profile Send private message
gotcha
Site Admin
Site Admin



Joined: Oct 25, 2004
Posts: 755

PostPosted: Wed May 28, 2008 7:56 pm
Reply with quote

Ok, try replacing all instances of topic_last_post_id with topic_first_post_id

This should switch it around like you want it... But let me know if it works or not Smile
 
View user's profile Send private message Visit poster's website
warren-the-ape




Joined: May 18, 2008
Posts: 12

PostPosted: Thu May 29, 2008 2:21 am
Reply with quote

Ey Gotcha thnx for you reply, ill try out asap, didnt knew that 'topic_first_post_id' existed.

Btw, this is not an issue anymore, its more logical to sort on the date the topic (article) was posted;

Quote:
I do want to sort the topics on last reply though


But your solution would probably just do that Cool
Ill let you know what came out of it.
 
View user's profile Send private message
warren-the-ape




Joined: May 18, 2008
Posts: 12

PostPosted: Thu May 29, 2008 2:01 pm
Reply with quote

Yeee it worked, thnx for your help Gotcha Cool

This is what it currently looks like;
Image

- Changed to static; removed javascript
- Added truncation (ellipsis) to 'topic title' and 'username'
- 'View More' -button links to specified forum
- Grouped config parameters in block code
- shuffled the lay-out a bit Wink


Complete code;
Code:
<?php
/* Forum Article Block                       */
/* Written By: gotcha - http://nukecoder.com */
/* Reworked By: warren the ape               */
/* Released August 2007, updated May 2008    */
/* 2008 (c) NukeCoder.com                    */

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

//CONFIGURATION//
$selectForum = '1'; //Insert the forum ID. Get it from the forum link
$forumMaxLength = '20'; //Max character length for topic links
$nameMaxLength = '10'; //Max character length for username

$post_image = "images/page_white.gif"; //Article icon link
$more_image = "images/page_white_more.gif"; //View more icon link


//NO NEED TO EDIT BELOW THIS LINE//
//-------------------------------//

define("_BBFORUM_TOTTOPICS","Topics ");
define("_BBFORUM_TOTPOSTS","Posts ");
define("_BBFORUM_TOTVIEWS","Views ");
define("_BBFORUM_TOTREPLIES","Replies ");
define("_BBFORUM_TOTMEMBERS","Members");
define("_BBFORUM_FORUM","Forums");
define("_BBFORUM_SEARCH","Search");

global $prefix, $user_prefix, $db, $user, $cookie, $group_id;

$content .= '
<div>
';

$sql = "SELECT
t.topic_id, t.topic_first_post_id, t.topic_title, f.forum_name,
f.forum_id, u.username, u.user_id, p.poster_id, p.post_time FROM
 ".$prefix."_bbtopics t, ".$prefix."_bbforums f,
 ".$prefix."_bbposts p, ".$user_prefix."_users u WHERE
 p.post_id = t.topic_first_post_id AND u.user_id = p.poster_id
 AND t.forum_id=f.forum_id AND f.auth_view=0 AND f.forum_id= $selectForum
 ORDER BY t.topic_first_post_id DESC
 LIMIT 5";
$result1 = $db->sql_query($sql);
while(list($topic_id, $topic_first_post_id, $topic_title, $forum_name, $forum_id, $username, $user_id, $poster_id, $post_time) = $db->sql_fetchrow($result1))

{
  $topicTitleModified = strlen($topic_title)<$forumMaxLength?$topic_title:substr($topic_title,0,$forumMaxLength).'...';
  $userNameModified = strlen($username)<$nameMaxLength?$username:substr($username,0,$nameMaxLength).'..';
 
  $content .= '
  <div style="padding-top: 12px;">
  <img src="'.$post_image.'" alt="" align="top" />
  <a href="modules.php?name=Forums&amp;file=viewtopic&amp;t='.$topic_id.'" title="'.$topic_title.'"><strong>'.$topicTitleModified.'</strong></a><br />
  <span style="display:block;padding-top:2px;">'.date("d-m-Y", $post_time).', by 
  <a  href="modules.php?name=Forums&amp;file=profile&amp;mode=viewprofile&amp;u='.$user_id.'" title="View Profile: '.$username.'">'.$userNameModified.'</a></span>
  </div>
  ';
}

$content .= '
</div>
  <div style="float:right;padding:8px 4px 8px 0px;">
  <a href="modules.php?name=Forums&file=viewforum&f='.$selectForum.'"><strong>View More</strong></a> <img src="'.$more_image.'" alt="" align="top" /></div>
';

?>


Perhaps needs some clean-up but I'm pretty happy with it so far Smile
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 5 Hours