Solved

paging like google

Posted on 2008-10-02
5
1,039 Views
Last Modified: 2012-06-21
when you search anything in google, at the bottom of the page there is a Gooooooooogle. and the page number correspond to the word "o". i'm trying to understand that concept but i can't. could someone explain to me how they do it? i can get the page to display 1 2 3 4 5 but to do the word i can't think of the way to approach. thanks guys
0
Comment
Question by:StewSupport
  • 3
  • 2
5 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 22630378
>> i can get the page to display 1 2 3 4 5 but to do the word
OK, but the links you currently have are really something like:
<a href="something.php?page=1">1</a><a href="something.php?page=1">2</a><a href="something.php?page=1">3</a>... 
The number between the <a></a> tags is irrelevant to your script. Your script only needs the number right after "page=".So what you can do is to define an array of letters:
$letters=array("","G","o","o","o","o","o","g","l","e"); 
and instead of printing 1, 2, 3 in between those <a> tags you would print:
$letters[$page]; 
echo "<a href='something.php?page=$page'>$letters[$page]</a>";

Open in new window

0
 

Author Comment

by:StewSupport
ID: 22632868
but then they also have the number at the bottom. does that mean they do it twice? and what if the number of page is 100 how does it know what to letter to repeat
0
 
LVL 82

Expert Comment

by:hielo
ID: 22638743
>>but then they also have the number at the bottom.
They are creating an html table. Each td of that table has a background image. Withing the td, they have the numeric links. The numeric links are positioned towards the bottom of the cell (td) and the height of each cell is beg enough so that the image appears on top of the numeric link
0
 

Author Comment

by:StewSupport
ID: 22659875
ok i understand that part. but how do i know when to repeat the Os' when and to not repeat the o and display the gles.
0
 
LVL 82

Accepted Solution

by:
hielo earned 250 total points
ID: 22663514
>>but how do i know when to repeat the Os'
That depends on how many links you are generating for the pagination. The are using 10, but Google does not have 10, so they "DECIDED" to elongate the word by putting more Os. Whatever YOU are doing, it would be your call on which letter to elongate. In reference to my first post, this:
$letters=array("","G","o","o","o","o","o","g","l","e");

could very well be:
$letters=array("","S","t","e","e","e","e","w");

assuming you are providing a 7-link/number pagination.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now