Jump to content

[SOLVED] Pagination tutorial


er0x

Recommended Posts

Link to tutorial = http://www.phpfreaks.com/tutorials/43/0.php

 

i like how it comes out in the end. But im having just a bit of editing problems

 

where?

 

    echo("<table>");

   

    while($row = mysql_fetch_array($result)){

        if ($bgcolor == "#E0E0E0"){

            $bgcolor = "#FFFFFF";

        }else{

            $bgcolor = "#E0E0E0";

        }

 

    echo("<tr bgcolor=".$bgcolor.">n<td>");

    echo($row["linkname"]);

    echo("</td>n<td>");

    echo($row["link"]);

    echo("</td>n</tr>");

    }

 

    echo("</table>");

this is how its currently set up (only changed the row names)

I have tried to configure it so it resembles...

 

The 2 back ground colors, *which is easy and i can do.*

Font color blue*i have the specific code but nothing i try works. how do i change the text color for the output?*

also, i want it to show the linkname and be clickable to take you to the link... and where the link is now i want show the description (which i can do)

 

so i really just need the font color different and to make the link clickable.

 

please help ive been on this for 3 days now.

Link to comment
Share on other sites

everything you posted is post pagnation. 

Pagnation comes into effect into in the query part the limits and setting of the limits

 

as for your question at hand.

its all html, just output anchor tags to make your links into links,  and to change text color you can put on the <td> or <a> tags the properties or classes of your choice.  Also your code is a bit strange, while it works and there are a lot of ways to do it one way I like to do a rotating color scheme is using a array of colors and then it can work for many colors. (fyi using the proper<?php opener in the fourm gives pretty print text)

<?php
$color = array("#EOEOEO","#FFFFFF");
$num_colors = count($color)-1;
$i = 0;
echo "<table>";
while($row = mysql_fetch_array($result)){
//Resets the color counter to 0 if it gets too high
    if($i > $num_colors){$i = 0;}
    echo "<tr bgcolor=\"".$color[$i]."\">
       <td><a href=\"".$row['link']."\" >".$row["linkname"]."</a></td></tr>";
$i++;
}
?>

 

I cleaned it up, altered it a bit, but I think what it is shooting for, less the links being colored, but if this makes sense I think you can figure out the link coloring. Also I changed the color to an array method so if you wanted say a 3 color rotation it could be easily done.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.