MyBB Community Forums

Full Version: 30 Most Recent Posts
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
ok, things this page will not do:

it will not use the sorting urls; you cannot do the inline edit on the thread title; there is no moderation option......

IF that is ok, then assuming you went for my three template solution in the post I linked you to then this is the newposts_latestthreads_thread template:

<tr tr:hover td {background-color:#000;}>
     <td align="center" class="{$bgcolor}{$thread_type_class}" width="2%"></td>
     <td align="center" class="{$bgcolor}{$thread_type_class}" width="2%">{$icon}</td>
     <td class="{$bgcolor}" onclick="window.location.href='showthread.php?tid={$thread['tid']}';" style="cursor: pointer;">
         <div>
             <span>{$thread['threadprefix']}<a href="{$thread['threadlink']}">{$thread['subject']}</a>{$thread['forumname']}</span>
             <div class="author smalltext">{$thread['profilelink']}</div>
         </div>
     </td>
     <td align="center" class="{$bgcolor}"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a></td>
     <td align="center" class="{$bgcolor}">{$thread['views']}</td>
     {$rating}
     <td class="{$bgcolor}{$thread_type_class}" style="white-space: nowrap; text-align: right;">
         <span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
         <a href="{$thread['lastpostlink']}">{$lang->lastpost}</a>: {$lastposterlink}</span>
     </td>
 {$modbit}
 </tr>

and this is the newposts_latestthreads template

<div class="float_left">
     {$multipage}
 </div>

 <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="clear: both;">
     <tr>
         <td class="thead" colspan="{$colspan}">
             <div>
                 <strong>{$foruminfo['name']}</strong>
             </div>
         </td>
     </tr>
     <tr>
         <td class="tcat" colspan="3" width="66%"><span class="smalltext"><strong>{$lang->thread} / {$lang->author}</strong></span></td>
         <td class="tcat" align="center" width="7%"><span class="smalltext"><strong>{$lang->replies}</strong></span></td>
         <td class="tcat" align="center" width="7%"><span class="smalltext"><strong>{$lang->views}</strong></span></td>
         {$ratingcol}
         <td class="tcat" align="right" width="20%"><span class="smalltext"><strong>{$lang->lastpost}</strong></span></td>
     </tr>
         {$threadlist}
 </table>

and this is the new php file:

<?php
 /**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://www.leefish.nl
 * License: Do not sell this 
 *
 * $Id: newposts.php 5297 2012-02-26 22:01:14Z Fish $
 */

 define("IN_MYBB", 1);
 //define("IN_newposts", 1);
 define('THIS_SCRIPT', 'newposts.php');
 // end editing

 $change_dir = "./";

 if(!@chdir($forumdir) && !empty($forumdir))
 {
     if(@is_dir($forumdir))
     {
         $change_dir = $forumdir;
     }
     else
     {
         die("\$forumdir is invalid!");
     }
 }

 $templatelist = "newposts,newposts_latestthreads_thread_lastpost,newposts_latestthreads_thread,ne?wposts_latestthreads,multipage_prevpage,multipage_nextpage,multipage_page_curren?t,multipage_page,multipage_start,multipage_end";

 require_once $change_dir."/global.php";
 require_once MYBB_ROOT."inc/functions_post.php";
 require_once MYBB_ROOT."inc/functions_user.php";
 require_once MYBB_ROOT."inc/class_parser.php";
 $parser = new postParser;

 // Load global language phrases
 $lang->load("portal");

 // Fetch the current URL
 $newposts_url = get_current_location();

 add_breadcrumb("Recent Posts", $mybb->settings['bburl']."/newposts.php");
     
 //pagination settings
 $mybb->settings['newposts_showdiscussions'] = '1';
 $mybb->settings['newposts_showpostsperpage'] = '10';
 $newposts = 30 ;
 $plugins->run_hooks("newposts_start");

 // get forums user cannot view
 $unviewable = get_unviewable_forums(true);
 if($unviewable)
 {
     $unviewwhere = " AND fid NOT IN ($unviewable)";
 }

 // Latest forum discussions
 if($mybb->settings['newposts_showdiscussions'] == 1 && $mybb->settings['newposts_showpostsperpage'])

 $page = intval($mybb->input['page']);
 if($page < 1) $page = 1;
 $perpage = intval($mybb->settings['newposts_showpostsperpage']);
 $multipage = multipage($newposts, $perpage, $page, $_SERVER['PHP_SELF'].'?paged=1'.$brl);
 {
     $altbg = alt_trow();
     $threadlist = '';
     $uv = str_replace('fid', 't.fid', $unviewwhere);

     $query = $db->query("
     SELECT t.*, u.username, u.displaygroup, u.usergroup, f.name AS forumname
         FROM ".TABLE_PREFIX."threads t
         LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
         LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=t.fid)
         WHERE 1=1 $uv AND t.visible='1'
         ORDER BY t.lastpost DESC 
         LIMIT ".(($page-1)*$perpage).", ".$perpage
     );
     while($thread = $db->fetch_array($query))
     {
         $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
         $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
         
         // Don't link to guest's profiles (they have no profile).
         
         if($thread['lastposteruid'] == 0)
         {
             $lastposterlink = $thread['lastposter'];
         }
         else
         {
         // Build the lastposter username
            
             $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
         }

         if(my_strlen($thread['subject']) > 45)
         {
             $thread['subject'] = my_substr($thread['subject'], 0, 45) . "...";
         }
         // Build the author username
         $thread['username'] = format_name($thread['username'], $thread['usergroup'], $thread['displaygroup']);
         $threadstarter = build_profile_link($thread['username'], $thread['uid']);
         $thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
         $thread['threadlink'] = get_thread_link($thread['tid']);
         $thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
         $thread['forumname'] = htmlspecialchars_uni($parser->parse_badwords($thread['forumname']));
         eval("\$threadlist .= \"".$templates->get("newposts_latestthreads_thread")."\";");
         $altbg = alt_trow();
     }
     if($threadlist)
     { 
         // Show the table only if there are threads
         eval("\$latestthreads = \"".$templates->get("newposts_latestthreads")."\";");
     }
 }

 $plugins->run_hooks("newposts_end");

 eval("\$newposts = \"".$templates->get("newposts")."\";");
 output_page($newposts);

 ?>

Try that. I think the icon will not work on a first try, but I am not gonna chase after that if this is not what you want. If it is then I will. Let me know.
It doesn't appear to have worked properly, it's a bit of a mess similar to what it looked like when I gave this a go myself.

http://thetflforum.co.uk.previewdns.com/...wposts.php

You should be able to access that page with the test account provided previously.
I sort of hoped you would have tested it on development. (XAMPP)

Additionally, no offence, but your board is slow as treacle for me (I have a slow internet) and I don't want to sort through billions of PMs looking for the login.

Please provide a screenshot.
I have disabled the maintenance mode for the time being so login is not required for viewing.

Here's a screenshot: http://kyleswebspace2.yolasite.com/resou...stserr.png
Ok,

try this in the newposts_latestthreads_thread

<tr tr:hover td {background-color:#000;}>
     <td align="center" class="trow1" width="2%"></td>
     <td align="center" class="trow1" width="2%">{$icon}</td>
     <td class="trow1" onclick="window.location.href='showthread.php?tid={$thread['tid']}';" style="cursor: pointer;">
         <div>
             <span>{$thread['threadprefix']}<a href="{$thread['threadlink']}">{$thread['subject']}</a></span>{$thread['forumname']}
             <div class="author smalltext">{$thread['profilelink']}</div>
         </div>
     </td>
     <td align="center" class="trow1"><a href="javascript:MyBB.whoPosted({$thread['tid']});">{$thread['replies']}</a></td>
     <td align="center" class="trow1">{$thread['views']}</td>
     {$rating}
     <td class="trow1" style="white-space: nowrap; text-align: right;">
         <span class="lastpost smalltext">{$lastpostdate} {$lastposttime}<br />
         <a href="{$thread['lastpostlink']}">Last post</a>: {$lastposterlink}</span>
     </td>
 {$modbit}
 </tr>

and in the newposts_latestthreads replace the lang -> bits with hardcoded values.
Getting there, just seems as if it's the icons that aren't working plus the forum name formatting doesn't appear to be showing correctly. I will make a thread using a thread icon now to test if that works fine:

http://kyleswebspace2.yolasite.com/resou...tserr2.png
That forum name formatting is coming from somewhere else - if you look in the template the forum name is just being printed out. What you can do is just take the forum name variable out.

I also said the icons probably would not work yet, that is code, so I will look at that - the LOOKS - that is css etc and that is your department Big Grin
I put the forum name formatting in, I'm not looking to now just take it out. It displays fine on the index page so surely there's a way for it to also display correctly on the new posts page. Also I can confirm that post icons also do not display on this page.
Kyle - I know the icons are not showing. Stop telling me. Big Grin

You can see it is only doing it on the "lines" - so how did you do that on the index page in the forum bits? Apply that styling around forumname variable and see if that works.
<span style="color:#ff0000;">Central Line</span>

On the index page that shows up as Central Line, I can't put this outside of the variables as they are different for different forums. I can't work out why on this page the whole code is showing as opposed to doing it's purpose.
Pages: 1 2 3 4 5