Page 1 of 1

Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 12:36 pm
by sturekdrf
Okay, so I am trying to have images setup to move my news system forwards and backwards and when its on the first post the arrow image used to move backwards is removed so you cannot go back further and letting the user know that this is the first post. Also the image used to move forward is not there when its on the newest post. My issue here is that when switching between them they do not have a fixed location so it looks TERRIBLE.

Take a look and see what I mean.
http://monstersagainstcancer.com/indextest.php

The issue is I do realize that since its in a div and the code is used by if statements there is no place holders, but I can't even figure out a better way to do that aside from the fact of just ALWAYS having them displayed. and having to code an if statement in there. so here is the code.
  <?php IF($page == 1){
}else{
echo '<a href="indextest.php?page='. ($page - 1) .'"><img src="\images\arrow.png" /></a>';
}
?> 

<?php 
IF($page == $fullcount){
}else{
echo '<a href="indextest.php?page='. ($page +1) .'"><img src="\images\arrow2.png" /></a>'; 
}
?>

Re: Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 1:04 pm
by jacek
IF($page == 1){
}else{
    echo '<a href="indextest.php?page='. ($page - 1) .'"><img src="\images\arrow.png" /></a>';
}
What the heck !? Why not do
IF($page != 1){
    echo '<a href="indextest.php?page='. ($page - 1) .'"><img src="\images\arrow.png" /></a>';
}
Anyway, The easiest thing to do would be to have a disabled arrow instead of just having it vanish. So it would be a grayscale version of the normal one or something so it looks disabled then you can do
IF($page == 1){
    echo '<img src="\images\arrow-disabled.png" />';
}else{
    echo '<a href="indextest.php?page='. ($page - 1) .'"><img src="\images\arrow.png" /></a>';
}
also you should really add alts to those images
IF($page == 1){
    echo '<img src="\images\arrow-disabled.png" alt="previous" />';
}else{
    echo '<a href="indextest.php?page='. ($page - 1) .'"><img src="\images\arrow.png" alt="previous" /></a>';
}
so people will know what they are if they don't load.

Re: Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 1:26 pm
by sturekdrf
Ahhh thanks, and common I have been doing php for eh less than a month lol so gota give me some slack on not having optimal code lol, but ill change it to be that way since its just good habbit. As for the alts yeah I just figured I would add the rest once I got it working. Lazy? Indeed. lol, but i was pretty sure I would have to change the entire code anyway lol. Thanks for the help :)

Re: Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 3:55 pm
by sturekdrf
actually can anyone using firefox test this page out.

monstersagainstcancer.com/indextest.php

the arrows at the bottom of the page werent showing up on my friends browser NO idea why.

Re: Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 4:12 pm
by jacek
sturekdrf wrote:actually can anyone using firefox test this page out.

monstersagainstcancer.com/indextest.php

the arrows at the bottom of the page werent showing up on my friends browser NO idea why.
According to FireBug you have used \ in your image location where you have to use / ;)

Re: Okay, minor issue with pagination images...

Posted: Thu Jun 28, 2012 6:47 pm
by sturekdrf
Oh man of all the dumb things lol, worked fine in chrome though lol

Re: Okay, minor issue with pagination images...

Posted: Fri Jun 29, 2012 12:51 pm
by jacek
sturekdrf wrote:Oh man of all the dumb things lol, worked fine in chrome though lol
Chrome is smart :)