drkshenronx Posted December 12, 2007 Share Posted December 12, 2007 ok heres what I want to do. I have phpbb+fetch_all installed and everything works ok but I don't know alot about php and I just want the latest 10 recent forum posts to be displayed on my main page. Here is the code to get the recent posts <!-- RECENT --> <?php if (isset($recent)) { ?> <table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline"> <tr> <td class="catHead" height="28"><span class="cattitle"><?php echo $lang['Topics']; ?></span></td> </tr> <tr> <td class="row1" align="left" width="100%"> <span class="gensmall"> <?php for ($i = 0; $i < count($recent); $i++) { ?> <?php echo create_date($board_config['default_dateformat'], $recent[$i]['post_time'], $board_config['board_timezone']); ?> <a href="<?php echo append_sid($phpbb_root_path . 'profile.php?mode=viewprofile&u=' . $recent[$i]['user_id']); ?>"> <?php echo $recent[$i]['username']; ?></a><br /> <img src="<?php echo $phpbb_root_path; ?>templates/subSilver/images/icon_latest_reply.gif" border="0" align="absmiddle" /> <a href="<?php echo append_sid($phpbb_root_path . 'viewtopic.php?p=' . $recent[$i]['post_id'] . '#' . $recent[$i]['post_id']); ?>"> <b><?php echo $recent[$i]['topic_title']; ?><?php if ($recent[$i]['topic_trimmed']) { echo '...'; } ?></b></a><br /> <?php } ?> </span> </td> </tr> </table> <br /> <?php } ?> <!-- RECENT --> Can anyone help me make it so only the last 10 posts will be displayed please. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/81288-solved-phpbb-fetch-all-show-only-10-recent/ Share on other sites More sharing options...
Northern Flame Posted December 12, 2007 Share Posted December 12, 2007 what is the value of the variable $recent Link to comment https://forums.phpfreaks.com/topic/81288-solved-phpbb-fetch-all-show-only-10-recent/#findComment-412544 Share on other sites More sharing options...
drkshenronx Posted December 12, 2007 Author Share Posted December 12, 2007 Nevermind everyone I figured this one out. To change the amount of posts that are viewed I had to edit the posts.php file in the mod directory. As for your question the $recent variable was as follows <?php $recent = phpbb_fetch_posts(null, FETCH_POSTS_LAST); ?> Thanks for the quick response. For anyone else who is trying to figure this out go into the phpbb_fetch_all directory and open the posts.php file. Next edit this line <?php $CFG['posts_limit'] = 10; ?> This should be the first line of actual code on the page as everything else is commented (other than the <?php tag of course). I figured this one out by meself .. yay!! I felt like an idiot in the end though ... the limit was already set to 10 Link to comment https://forums.phpfreaks.com/topic/81288-solved-phpbb-fetch-all-show-only-10-recent/#findComment-412570 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.