Solved

paging like google

Posted on 2008-10-02
5
1,040 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

773 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