pagination content shifting down a...

User 78051 Photo


Registered User
201 posts

Hi guys

Just wondering what I am doing wrong with this project file. Am trying to get the pagination (this bit here) to work but for some reason the end keeps dropping down a line and am unsure how to correct it.

All input gratefully received.

Many thanks

Jamie
User 434929 Photo


Ambassador
938 posts

Try out the updated one here:
https://www.dropbox.com/s/69n6jeq3u3ksr … d.rsd?dl=0

It's container set auto , you have to change to custom width
Guys at coffeecup are awesometacular.
User 78051 Photo


Registered User
201 posts

thanks Mansour. The problem with setting a width is that when there are more pages within the pagination then it will just do the same again as the original 'problem'

EDIT. and the problem with floating the text-link to the right is that then the order is screwed up (it reverses) which screws up my php.
User 379556 Photo


Registered User
1,583 posts

The order of items floating left or right next to each other is something I have found tricky in RSD, but there does seem to be a procedure for getting the items into the order one wants. I do it as follows -

A. If all the items are set to float left, but are not in the order I want,
1. I grab (left mouse click and hold the mouse button down) the item I want to be leftmost, move it to the rightmost position (and leave it there by releasing the mouse button)
2. I then do the same with the item I want to be second from the left.
3. I then do the same with the item I want to be third from left, and so on until all the items are in the order I want.

B If all the items are set to float right, but are not in the order I want,
1. I grab (left mouse click and hold the mouse button down) the item I want to be rightmost, move it to the leftmost position (and leave it there by releasing the mouse button)
2. I then do the same with the item I want to be second from the right.
3. I then do the same with the item I want to be third from the right, and so on until all the items are in the order I want.

I think that the procedure at B above may allow the effect wanted. I tried it by removing the text links from the container and putting them into the column (and deleting the container), setting them to float right, and then ordering them as above. It seemed to work. The attached screenshot was taken while the hidden objects were set to show.

Frank
Attachments:
User 78051 Photo


Registered User
201 posts

thanks Frank

unfortunately your solutions, although good, only work on static content. As soon as the content becomes dynamic, as is the case with pagination, you stop manually re-ordering and moving the content around so if you do float each text element then they end up reversed

cheers

Jamie
User 187934 Photo


Senior Advisor
20,266 posts
Online Now

I would think the php script would handle the order.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 78051 Photo


Registered User
201 posts

Hey Eric, yes it does if the elements dont have a float: right associated with it. No float and float: left is fine, its just when float:right is applied, it all gets reversed

if it helps put it in context, this is the recordset for the pagination and also the code for the pagination itself:

<?php
$maxRows_NewsResults =15;
$NewsResults = new WA_MySQLi_RS("NewsResults",$DBConnection,$maxRows_NewsResults);
$NewsResults->setQuery("SELECT * FROM news WHERE Live = 1 ORDER BY NewsDate DESC");
$NewsResults->execute();

$NewsResultsTotal = new WA_MySQLi_RS("NewsResultsTotal",$DBConnection);
$NewsResultsTotal->setQuery("SELECT count(1) a FROM news WHERE Live = 1");
$NewsResultsTotal->execute();
$NewsResults_Total = (int)$NewsResultsTotal->Results[0]['a'];
$Req_Pages = ceil($NewsResults_Total/$maxRows_NewsResults);
?>

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

$totalRows_NewsResults = $NewsResults_Total;

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

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

$totalPages_NewsResults = ceil($totalRows_NewsResults/$maxRows_NewsResults)-1;


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

$elems[] = "<span style=\"float: left; margin-top: 0; margin-bottom: 0; margin-left: 1%; padding: 4px; width: auto; border: 1px solid #2094d1; text-align: center; text-decoration: none; font-size: 12px; line-height: 1; background-color: #2094d1; color: #fff;}\">".($i+1)."</span>";
}
else
{
$elems[] = "<a href=\"news.php?pageNum_NewsResults=$i\" class=\"link-text paginationText\">".($i+1)."</a>";
}
}

echo implode(" ",$elems);
}
?>
<?php if ($NewsResults->PageNum < $NewsResults->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $NewsResults->getNextPageLink(); ?>" class="link-text paginationText mobile">&gt;</a>
<?php } // Show if mysqli not last page ?>
<?php if ($NewsResults->PageNum < $NewsResults->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $NewsResults->getLastPageLink(); ?>" class="link-text paginationText mobile">&gt;&gt;</a>
<?php } // Show if mysqli not last page ?>
<?php if ($NewsResults->PageNum < $NewsResults->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $NewsResults->getNextPageLink(); ?>" class="link-text paginationText desktop">next &gt;</a>
<?php } // Show if mysqli not last page ?>
<?php if ($NewsResults->PageNum < $NewsResults->TotalPages) { // Show if mysqli not last page ?>
<a href="<?php echo $NewsResults->getLastPageLink(); ?>" class="link-text paginationText desktop">last &gt;&gt;</a>
<?php } // Show if mysqli not last page ?>
</div>
User 379556 Photo


Registered User
1,583 posts

Just musing:

1. How closely does the float:right attribute have to be to cause the problem? It seems that there was no problem when the text links were individually floating left, but grouped in a container that floated right.
2. What if each of the text links were floated left, but were individually in containers of fixed pixel width (matching the width of the the text link), and all those containers were floated right and ordered in the way I mentioned?

Frank

User 187934 Photo


Senior Advisor
20,266 posts
Online Now

I don't see any css with that script.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.