miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /  
 

Controlling the amount of recent posts shown on main page

 
Author SteveB
Partaker
#1 | Posted: 23 Jun 2012 10:34 
Hi
Im a newbie to miniBB but have to say I am very pleased with it and the support received. Great job !
I always try to find answers in the FAQ but sometimes just cannot see what I'm looking for.... sorry if there is a similar post already.

So ...
is there a way to limit the number of "recent topics" that show up on the main page ?
Thanks
Steve

Author Paul
Lead Developer 
#2 | Posted: 23 Jun 2012 14:31 
Definitely you should read Manual more carefully :)

This is a setting from setup_options.php:

$viewlastdiscussions=30; //How many last discussions to show on 1st page, 0 disables last discussions (see below what means "last discussions").

Author SteveB
Partaker
#3 | Posted: 25 Jun 2012 11:12 
THANKS !!

Author Jaime
Partaker
#4 | Posted: 2 May 2014 12:43 
Now i have $viewlastdiscussions=10; and $viewmaxtopic=20; Is there a way, via bb_plugins, on the side 1 (lastdiscussions) to display 10 posts, but on the other following (lastdiscussions) sides then 20 posts?

Author Paul
Lead Developer 
#5 | Posted: 3 May 2014 16:23 
You may try the following code for bb_plugins.php:

$genViewlastdiscussions=20;
if($page==PAGE1_OFFSET+1) $viewlastdiscussions=10; else $viewlastdiscussions=$genViewlastdiscussions;

if($action==''){

$totalForumsTopics=0;
if($cols=db_simpleSelect(0,$Tf,'forum_id, topics_count')){
do{
$forum=$cols[0];
$disallowedForums=getAccess($clForums, $clForumsUsers, $user_id);
if( (isset($lastOut) and in_array($forum, $lastOut)) or (is_array($disallowedForums) and in_array($forum, $disallowedForums) ) ) {} else $totalForumsTopics+=$cols[1];
}
while($cols=db_simpleSelect(1));
}

$pageNavExtract='';
if(!isset($disableNavDisplay) and $totalForumsTopics>0){

if($sortBy==0){
if(isset($mod_rewrite) and $mod_rewrite) {
$urlp=$main_url; $urlType='Extranavmr';
}
else {
$urlp="https://www.minibb.com/forums/{$indexphp}"; $urlType='Extranav';
}
}
else{
$urlp="https://www.minibb.com/forums/{$indexphp}sortBy=1"; $urlType='Gen';
}

$pageNavExtract=pageNav(PAGE1_OFFSET+1,$totalForumsTopics, $urlp,$genViewlastdiscussions,FALSE,$urlType);
}
if($pageNavExtract!='') $mbpn='<br />';

}
then for templates/main_last_discussions.html or templates/main_modern_layout.html, instead of {$pageNavExtra}, you should paste:

{$pageNavExtract}
This solution will take an additional, still very lite request to the database, and it's a bit dirty, 'cause this request will be later repeated in the script; but probably having such a requirement, you should not care about it.

Author Jaime
Partaker
#6 | Posted: 3 May 2014 17:06 
Perfekt Paul! Thank you!

Author Jaime
Partaker
#7 | Posted: 4 May 2014 17:07 
But after that, determined on the first page total number of pages is greater than the rendering on the following pages. Logically!

Is there possibly a simple solution ... if you want to preserve the look of the Navbar?

It looks strange when on the first page you get displayed (example) 400 following pages, but are then you see on the next sites only 200 pages ;-)

Of course, once can - in the template main_last_discussion.html - simply replace {$pageNavExtra} with a link to the next page 2 ... And then no more NavBar is created on this one page.

Author Paul
Lead Developer 
#8 | Posted: 4 May 2014 19:24 
Jaime:
on the first page total number of pages is greater than the rendering on the following pages
Got it.

Updated the solution above, check on your end, and report please.

Author Jaime
Partaker
#9 | Posted: 4 May 2014 19:40 
Great! Works exactly as it should! Thanks Paul

Custom Tutorials and Modifications miniBB Support Forums / Custom Tutorials and Modifications /
 Controlling the amount of recent posts shown on main page
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Proceed with the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑