Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP help for pagination...HELP!

$
0
0
Hi folks, 
 
you could help me with a PHP question. I changed our pagination from .../?page=0%2C0%2C1 to ?page=1.
 
The problem now is that a few custom codes aren't working anymore. There is one code that puts all following pages as nofollow/noindex. The code worked with the long pagination URL but not with the short. Here's the code:
 
<?php
$target_page= explode("/",$_SERVER['REQUEST_URI']);
$target_page= $target_page[1];

$pages_with_nofollow = array(
  'nyc-apartments-by-school',
  'park',
);

if(in_array($target_page, $pages_with_nofollow) ===true){
  $target_page_num = isset($_GET['page']) ? explode(",",$_GET['page']) : 0;
  $target_page_num = !empty($target_page_num) ?  $target_page_num[2] : 0;
  if($target_page_num > 0){
     $variables['head'] .= '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">';
  }
  
  
}
?>
What do I need to change?
 
Thank you!!!

Viewing all articles
Browse latest Browse all 13200

Trending Articles