Solved

paging like google

Posted on 2008-10-02
5
1,047 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to implement server side field validation and display customized error messages to the client.
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 count occurrences of each item in an array.

691 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