close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

truncate pagination

Thread began 12/03/2018 4:50 am by Jamie | Last modified 12/17/2018 11:27 am by Ray Borduin | 62 views | 7 replies |

Jamie

truncate pagination

Hey Ray

Am trying to figure out how to get my pagination code

<div class="container paginationContainer">
<?php if ($Categories->PageNum > 0) { // Show if mysqli not first page ?>
<a href="<?php echo $Categories->getFirstPageLink(); ?>" class="link-text paginationLink">&lt;&lt;</a>
<?php } // Show if mysqli not first page ?>
<?php if ($Categories->PageNum > 0) { // Show if mysqli not first page ?>
<a href="<?php echo $Categories->getPrevPageLink(); ?>" class="link-text paginationLink">&lt;</a>
<?php } // Show if mysqli not first page ?>
<?php

$totalRows_Categories = $Categories_Total;

$pageNum_Categories = 0;
if (isset($_GET['pageNum_Categories'])) {
$pageNum_Categories = $_GET['pageNum_Categories'];
}

$incdone = false;
if ($maxRows_Categories == 0)
{
$maxRows_Categories =1;
$incdone = true;
}

$totalPages_Categories = ceil($totalRows_Categories/$maxRows_Categories)-1;


if($totalPages_Categories > 0 && !$incdone )
{
$elems = array();
for ($i=0;$i<$Req_Pages;$i++)
{
if ($i==$pageNum_Categories)
{

$elems[] = "<span class=\"paginationLinkActive\">".($i+1)."</span>";
}
else
{
$elems[] = "<a href=\"".$Categories->getPageLink($i)."\" class=\"link-text paginationLink\">".($i+1)."</a>";
}
}

echo implode(" ",$elems);
}
?>
<?php if ($Categories->PageNum < $Categories->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $Categories->getNextPageLink(); ?>" class="link-text paginationLink">&gt;</a>
<?php } // Show if mysqli not first page ?>
<?php if ($Categories->PageNum < $Categories->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $Categories->getLastPageLink(); ?>" class="link-text paginationLink">&gt;&gt;</a>
<?php } // Show if mysqli not first page ?>
</div>

which looks like this http://prntscr.com/lq09yc so that it outputs like the top demo on this codepen https://codepen.io/allicarn/pen/jPowab (the one title '12 Elements') and has the same sort of function as you click through

Many thanks

Sign in to reply to this post

Ray BorduinWebAssist

Here is an include file I made for someone else that does a navigation menu like that:

http://www.webassist.com/forums/posts.php?id=41374

Sign in to reply to this post

Jamie

perfect - got it working many thanks: http://clients.motley.site/moonraker/shop/folding

Sign in to reply to this post

Ray BorduinWebAssist

I went in and made a small change since it wasn't working well for middle pages. Download your include file to make sure you keep my changes... I also updated the original post include file.

Sign in to reply to this post

Jamie

many thanks Ray

Sign in to reply to this post

Jamie

Hey Ray. You know you changed the rsobj.php file the other day from

$this->CurrentPage = $_SERVER['PHP_SELF'];

to

$this->CurrentPage = $_SERVER['REQUEST_URI'];

so that the URL structure was retained to stop the page not returning any results?

Well its thrown up another issue now where if you navigate to a page further along, after the first new page selection, you cannot then move to any other page within the pagination. To see what I mean, go here http://clients.motley.site/moonraker/shop/folding-knives and go to, for example, page 6 and then try to go to another page

cheers

Sign in to reply to this post

Ray BorduinWebAssist

I've updated the rsobj.php file on your site to fix this issue.

Sign in to reply to this post

Ray BorduinWebAssist

This post has been deleted.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...