Forum Moderators: coopster

Message Too Old, No Replies

need php code - duplicate title/meta tags new pages

webmaster tools errors

         

apeepa

2:53 am on Dec 4, 2008 (gmt 0)

10+ Year Member



Hi again - thank you all for your help last time. Once again my php dummy and really need your help.

- I had a developer code my site about a year ago-
so I'm advertising certain products on my website - when there are more then 15 items per page, it creates a link to go to page 2, 3, etc...

such as my first page would be:

mysite.com/bank_cards.php

My second page and others would show up be: (cp would change based on page number)

mysite.com/bank_cards.php?type=&sp=1&ls=15&cp=2&search_field=&all=all&typeid=

The problem arises is when a person would click on page 2, the option for page 1 displays as:

mysite.com/bank_cards.php?type=&sp=1&ls=0&cp=1&search_field=&all=all&bank_id=25

This is a problem as google treats this as duplicate content. Can you please assist me in writing a rule that would transform

mysite.com/bank_cards.php?type=&sp=1&ls=0&cp=1&search_field=&all=all&bank_id=25 into mysite.com/bank_cards.php

Here is the code that is written in that part of the section. Much appreciated!

$pages="";
if($sp>1){
$psp=$sp-15;
$pcp=$psp;
$ls=($psp-1) * 15;
$pages.="<td align='center'><a href='bank_cards.php?type=$type&sp=$psp&ls=$ls&pcp=$cp&search_field=$search_field&all=all&bank_id=$_REQUEST[bank_id]'>Prev</a></td>";
}
for($i=$sp ; $i<($sp+15) && $i < $pageno+1 ; $i++){
if($i==$_REQUEST[cp] ¦¦ ( !isset($_REQUEST[cp]) && $i == 1 ) ){
$pages.= "<td align='center' bgcolor='#E9F0FA' >$i</td>";
}
else{
$sp=$sp;
$cp=$i;
$ls=($i - 1) * 15;
$pages.="<td align='center'><a href='bank_cards.php?type=$type&sp=$sp&ls=$ls&cp=$cp&search_field=$search_field&all=all&bank_id=$_REQUEST[bank_id]'>$i</a></td>";
}
}
if($new_pages>0){
$nsp=$sp+15;
$ncp=$nsp;
$ls=($nsp-1) * 15;
$pages.="<td align='center'><a href='bank_cards.php?type=$type&sp=$nsp&ls=$ls&cp=$ncp&search_field=$search_field&all=all&bank_id=$_REQUEST[bank_id]'>Next</a></td>";
}

jatar_k

6:34 pm on Dec 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



not sure

You would need to identify the params of the first page, from what I can tell that could be either

ls=0 or cp=1

or maybe both, very hard to tell, it might also always be $i=1

you would need to test for whichever of those is the correct state for the first page and output a different link, in both the "Prev" link and in the numbers

for the Prev link it might be changing this

$pages.="<td align='center'><a href='bank_cards.php?type=$type&sp=$psp&ls=$ls&pcp=$cp&search_field=$search_field&all=all&bank_id=$_REQUEST[bank_id]'>Prev</a></td>";

to

if ($ls <= 0) { // again I don't know the right test
$pages.="<td align='center'><a href='bank_cards.php'>Prev</a></td>";
} else {
$pages.="<td align='center'><a href='bank_cards.php?type=$type&sp=$psp&ls=$ls&pcp=$cp&search_field=$search_field&all=all&bank_id=$_REQUEST[bank_id]'>Prev</a></td>";
}

you're definitely going to have to play around a bit