Okay, minor issue with pagination images...

Ask about a PHP problem here.
Post Reply
sturekdrf
Posts: 40
Joined: Fri Jun 15, 2012 8:25 pm

Okay, minor issue with pagination images...

Post 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>'; 
}
?>
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post 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.
Image
sturekdrf
Posts: 40
Joined: Fri Jun 15, 2012 8:25 pm

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

Post 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 :)
sturekdrf
Posts: 40
Joined: Fri Jun 15, 2012 8:25 pm

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

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post 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 / ;)
Image
sturekdrf
Posts: 40
Joined: Fri Jun 15, 2012 8:25 pm

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

Post by sturekdrf »

Oh man of all the dumb things lol, worked fine in chrome though lol
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

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

Post by jacek »

sturekdrf wrote:Oh man of all the dumb things lol, worked fine in chrome though lol
Chrome is smart :)
Image
Post Reply