New Beta Forum - Help us test!

74 posts by 20 authors in: Forums > CMS Builder
Last Post: October 8, 2013   (RSS)

By ht1080z - January 13, 2013

Hello Jerry,

Thank you for you post, i already have this code and its very usefull. My latest created website have listing page with more that 800 item, 10 per page. i need something like this new forum script use (First   Prev   4   5   6   7   8   9   10   Next   Last ) so i can see only 7-10 page numbers with first, last, prev and next links.

Karls

By weblm - January 13, 2013

Karls,

Here's code that I'm using that's "closer" to the forum code....not exact, but maybe it will help you get waht you need.

            <!-- START PAGINATION CODE -->
            <div class="pagelinks" align="center">
                <?php  
                    if (@!$_GET['page']): $current_page = "1";
                    else: $current_page = $_GET['page'];    
                endif;  ?>
                    
                <?php
                    $startNumber = max($current_page - 2, 1);
                    $endNumber   = min($current_page + 2, $your_tableMetaData['totalPages']);
                ?>

                <?php if ($your_tableMetaData['prevPage']): ?>
                    <a href="<?php echo $your_tableMetaData['prevPageLink'] ?>"><img src="/images/arrow-left.png" border="0" /> prev</a>&nbsp;&nbsp;&nbsp;
                    <?php if ($startNumber > '1'): ?>
                        <a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => '1' ))) ?> ">1</a> ...
                    <?php endif ?>
                <?php else: ?>
                    &nbsp;  
                <?php endif ?>    

            <?php foreach (range($startNumber,$endNumber) as $page): ?>
                
                    <?php if ($page == $current_page): ?>
                     <b>[<?php echo $page; ?>]</b>
                    <?php else: ?>
                     <a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => $page ))) ?>"><?php echo $page; ?></a>
                    <?php endif ?>
            
                <?php endforeach; ?>
                
                
                <?php if ($your_tableMetaData['nextPage']): ?>
                    <?php if ($your_tableMetaData['totalPages'] > $endNumber): ?>
                        ... <a href="?<?php echo http_build_query(array_merge($_REQUEST, array( 'page' => $your_tableMetaData['totalPages'] ))) ?> "><?php echo $your_tableMetaData['totalPages'];?></a>
                    <?php endif ?>
                        &nbsp;&nbsp;&nbsp;<a href="<?php echo $your_tableMetaData['nextPageLink'] ?>">next <img src="/images/arrow-right.png" border="0" /></a>  
                    <?php else: ?>   
                        &nbsp;  
                <?php endif ?>                            
            </div>
            <!-- /END PAGINATION CODE -->

-Kevin

LM

By ht1080z - January 14, 2013

Hi Kevin,

Thank you for this script! Beautiful solution!

Karls

By wizzle - January 15, 2013

I don't like that when I do a search, it searches all the forums.  I would like it to search the forum I am in or at least allow me to chose which ones to search through.  Specifically in this case, I only want to search the CMSB and add-ons forums, but when I search I got a lot of posts from the old prodocts like article manager.

Also, I don't like see multiple search results from the same thread.  once I click on a result I generally read the whole thread.  But then that same thread shows up several more times in my list of search results.

Greg Williams

By sidcam - January 15, 2013

I've experienced the same thing as wizzle.  Perhaps you could have an Advanced Search button with a dropdown or popup for better defining searches.

Two things:

1) Can you make it so when you click on a column header it sorts by that column in an alternating asending/decending mode?  It would make it easier to find things.

2) Discovered an oddity (not a major issue or a problem).  When I look at my profile's posts it appears they sort by the full date except posts from the Article Manager forum which appear to be showing up based on month/day only.  I attached a photo of a 2010 Article Manager post mingled in with my current posts so you can see what I'm talking about.

Attachments:

cmsb-forum.jpg 63K

By Chris - January 17, 2013

@everyone: Message received: if we add Unread Topics, it'll have to work cross-device. Thanks for the input!

@ht1080z: The code I used is very similar to weblm's, but $startNumber and $endNumber were generated like this:

// get range of page numbers
$maxLinks = 7;
$selectedPage = $recordsMetaData['page'];
$startNumber = $selectedPage;
$endNumber = $selectedPage;
while ($maxLinks > 1) {
  $match = false;
  if ($endNumber < $recordsMetaData['totalPages'] && --$maxLinks) { $endNumber++; $match = true; }
  if ($startNumber > 1 && --$maxLinks) { $startNumber--; $match = true; }
  if (!$match) { break; }
}

@wizzle: Excellent point, thanks! I'll add that to my list.

@sidcam: I'll add your #1 to the list too. Thanks for #2, I've fixed that.

All the best,
Chris

Thank you all for keeping up with this.

I think the spellchecker will be make a big difference. So will the code block fixes.

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Djulia - January 31, 2013

Hi,

I had this error by visiting the forum and after having used the back button of the browser :

Couldn't start session! 'session_start(): ps_files_cleanup_dir: opendir(/var/lib/php/session) failed: Permission denied (13)'!

Djulia

By Chris - February 1, 2013

Thanks, Djulia! We'll look into that.

All the best,
Chris